Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultOptions = &HandlerOptions{ SortLongest: true, SkipUnchanged: true, Truncates: true, LightBg: false, TruncateLength: 15, TimeFormat: time.Stamp, KeyColor: color.New(color.FgGreen), ValColor: color.New(color.FgHiWhite), TimeLightBgColor: color.New(color.FgBlack), TimeDarkBgColor: color.New(color.FgWhite), MsgLightBgColor: color.New(color.FgBlack), MsgAbsentLightBgColor: color.New(color.FgHiBlack), MsgDarkBgColor: color.New(color.FgHiWhite), MsgAbsentDarkBgColor: color.New(color.FgWhite), DebugLevelColor: color.New(color.FgMagenta), InfoLevelColor: color.New(color.FgCyan), WarnLevelColor: color.New(color.FgYellow), ErrorLevelColor: color.New(color.FgRed), PanicLevelColor: color.New(color.BgRed), FatalLevelColor: color.New(color.BgHiRed, color.FgHiWhite), UnknownLevelColor: color.New(color.FgMagenta), }
Functions ¶
Types ¶
type Handler ¶
type Handler interface {
CanHandle(line []byte) bool
Prettify(skipUnchanged bool) []byte
logfmt.Handler
}
Handler can recognize it's log lines, parse them and prettify them.
type HandlerOptions ¶
type HandlerOptions struct {
Skip map[string]struct{}
Keep map[string]struct{}
SortLongest bool
SkipUnchanged bool
Truncates bool
LightBg bool
TruncateLength int
TimeFormat string
KeyColor *color.Color
ValColor *color.Color
TimeLightBgColor *color.Color
TimeDarkBgColor *color.Color
MsgLightBgColor *color.Color
MsgAbsentLightBgColor *color.Color
MsgDarkBgColor *color.Color
MsgAbsentDarkBgColor *color.Color
DebugLevelColor *color.Color
InfoLevelColor *color.Color
WarnLevelColor *color.Color
ErrorLevelColor *color.Color
PanicLevelColor *color.Color
FatalLevelColor *color.Color
UnknownLevelColor *color.Color
}
func (*HandlerOptions) SetKeep ¶
func (h *HandlerOptions) SetKeep(keep []string)
func (*HandlerOptions) SetSkip ¶
func (h *HandlerOptions) SetSkip(skip []string)
type JSONHandler ¶
type JSONHandler struct {
Opts *HandlerOptions
Level string
Time time.Time
Message string
Fields map[string]string
// contains filtered or unexported fields
}
JSONHandler can handle logs emmited by logrus.TextFormatter loggers.
func (*JSONHandler) Prettify ¶
func (h *JSONHandler) Prettify(skipUnchanged bool) []byte
Prettify the output in a logrus like fashion.
func (*JSONHandler) TryHandle ¶
func (h *JSONHandler) TryHandle(d []byte) bool
TryHandle tells if this line was handled by this handler.
func (*JSONHandler) UnmarshalJSON ¶
func (h *JSONHandler) UnmarshalJSON(data []byte) bool
UnmarshalJSON sets the fields of the handler.
type LogfmtHandler ¶
type LogfmtHandler struct {
Opts *HandlerOptions
Level string
Time time.Time
Message string
Fields map[string]string
// contains filtered or unexported fields
}
LogfmtHandler can handle logs emmited by logrus.TextFormatter loggers.
func (*LogfmtHandler) Prettify ¶
func (h *LogfmtHandler) Prettify(skipUnchanged bool) []byte
Prettify the output in a logrus like fashion.
func (*LogfmtHandler) TryHandle ¶
func (h *LogfmtHandler) TryHandle(d []byte) bool
CanHandle tells if this line can be handled by this handler.
func (*LogfmtHandler) UnmarshalLogfmt ¶
func (h *LogfmtHandler) UnmarshalLogfmt(data []byte) bool
HandleLogfmt sets the fields of the handler.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.
