Documentation ¶
Index ¶
- type Config
- type Logger
- func (l Logger) Dump(v interface{})
- func (l Logger) DumpExit(v interface{})
- func (l Logger) Err(err error) error
- func (l Logger) Log(keyvals ...interface{}) error
- func (l Logger) Msg(message string) error
- func (l Logger) Msgr(message string, keyvals ...interface{}) error
- func (l Logger) SetLogger(logr klog.Logger)
- func (l Logger) StdLogger() klog.Logger
- type LoggerExcludes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // The name of the logger. Shows up in the output. Name string // The logger to use. Allows setting output and format. Logger klog.Logger // Show call information in log output (can affect performance) Caller bool // The call stack depth. Useful for setting different depths for apps versus testing. CallDepth int // Excludes allows excluding logger contexts by name. Excludes []string }
Config allows sharing a log config accross loggers.
type Logger ¶
type Logger struct { Caller bool // Include the caller field name in the log output. CallDepth int // Call stack depth for logging // contains filtered or unexported fields }
Logger implements the go-kit logger type.
func NewLogger ¶
NewLogger wraps a logger with a name context and caller information. If a named context is specified in the excludes slice, then any logging to that context will be ignored.
func WithCallDepth ¶
func (Logger) Dump ¶
func (l Logger) Dump(v interface{})
Dump pretty prints the v interface into the msg field
The output is a string containing escaped newlines. It is possoble to show the structured output in one line using:
echo -e $(go test -v ./pkg/parser -test.run=".*<test_id>*_Parse.*" -debug -exclude=lexer | grep "msg=dump" | sed -n "s/.*obj=\"\(.*\)\"/\1/p")
func (Logger) DumpExit ¶
func (l Logger) DumpExit(v interface{})
DumpExit pretty prints the v interface to msg field and terminates program execution.
The output is a string containing escaped newlines. It is possoble to show the structured output in one line using:
echo -e $(go test -v ./pkg/parser -test.run=".*<test_id>*_Parse.*" -debug -exclude=lexer | grep "msg=dump" | sed -n "s/.*obj=\"\(.*\)\"/\1/p")
type LoggerExcludes ¶
type LoggerExcludes []string // Exclude a log context from being shown in the output
LoggerExcludes satisfies the flag Value interface
func (*LoggerExcludes) String ¶
func (e *LoggerExcludes) String() string
String returns LoggerExcludes as a formatted string