Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultOptions = &HandlerOptions{ SortLongest: true, SkipUnchanged: true, Truncates: false, LightBg: false, TruncateLength: 100, TimeFormat: time.Stamp, KeyColor: color.New(color.FgYellow), ValColor: color.New(color.FgHiBlue), TimeLightBgColor: color.New(color.Reset), TimeDarkBgColor: color.New(color.Reset), MsgLightBgColor: color.New(color.Reset), MsgAbsentLightBgColor: color.New(color.FgHiBlack), MsgDarkBgColor: color.New(color.Reset), MsgAbsentDarkBgColor: color.New(color.FgHiWhite), DebugLevelColor: color.New(color.FgCyan), InfoLevelColor: color.New(color.FgGreen), WarnLevelColor: color.New(color.FgYellow), ErrorLevelColor: color.New(color.FgRed), PanicLevelColor: color.New(color.BgRed, color.FgWhite), FatalLevelColor: color.New(color.BgHiRed, color.FgHiWhite), UnknownLevelColor: color.New(color.FgHiBlack), }
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 ¶ added in v0.3.6
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 ¶ added in v0.3.6
func (h *LogfmtHandler) Prettify(skipUnchanged bool) []byte
Prettify the output in a logrus like fashion.
func (*LogfmtHandler) TryHandle ¶ added in v0.3.6
func (h *LogfmtHandler) TryHandle(d []byte) bool
CanHandle tells if this line can be handled by this handler.
func (*LogfmtHandler) UnmarshalLogfmt ¶ added in v0.3.6
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.