Documentation
¶
Index ¶
- Variables
- func Scanner(src io.Reader, dst io.Writer, opts *HandlerOptions) error
- type Handler
- type HandlerOptions
- type JSONHandler
- type JournalJSONHandler
- func (h *JournalJSONHandler) Prettify(skipUnchanged bool) []byte
- func (h *JournalJSONHandler) TryHandle(d []byte) bool
- func (h *JournalJSONHandler) TryHandleEntry(entry map[string]interface{}) bool
- func (h *JournalJSONHandler) UnmarshalJournalEntry(raw map[string]interface{}) error
- func (h *JournalJSONHandler) UnmarshalJournalJSON(data []byte) error
- type LogrusHandler
Constants ¶
This section is empty.
Variables ¶
var DefaultOptions = &HandlerOptions{ SortLongest: true, SkipUnchanged: false, 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) error
UnmarshalJSON sets the fields of the handler.
type JournalJSONHandler ¶
type JournalJSONHandler struct {
Opts *HandlerOptions
Level string
Time time.Time
Message string
Fields map[string]string
// contains filtered or unexported fields
}
JournalJSONHandler can handle logs emmited by logrus.TextFormatter loggers.
func (*JournalJSONHandler) Prettify ¶
func (h *JournalJSONHandler) Prettify(skipUnchanged bool) []byte
Prettify the output in a logrus like fashion.
func (*JournalJSONHandler) TryHandle ¶
func (h *JournalJSONHandler) TryHandle(d []byte) bool
TryHandle tells if this line was handled by this handler.
func (*JournalJSONHandler) TryHandleEntry ¶
func (h *JournalJSONHandler) TryHandleEntry(entry map[string]interface{}) bool
TryHandleMap tells if this line was handled by this handler.
func (*JournalJSONHandler) UnmarshalJournalEntry ¶
func (h *JournalJSONHandler) UnmarshalJournalEntry(raw map[string]interface{}) error
func (*JournalJSONHandler) UnmarshalJournalJSON ¶
func (h *JournalJSONHandler) UnmarshalJournalJSON(data []byte) error
UnmarshalJournalJSON sets the fields of the handler.
type LogrusHandler ¶
type LogrusHandler struct {
Opts *HandlerOptions
Level string
Time time.Time
Message string
Fields map[string]string
// contains filtered or unexported fields
}
LogrusHandler can handle logs emmited by logrus.TextFormatter loggers.
func (*LogrusHandler) CanHandle ¶
func (h *LogrusHandler) CanHandle(d []byte) bool
CanHandle tells if this line can be handled by this handler.
func (*LogrusHandler) Prettify ¶
func (h *LogrusHandler) Prettify(skipUnchanged bool) []byte
Prettify the output in a logrus like fashion.
