Documentation
¶
Overview ¶
Package logger defines a simple logger API with level of logging control.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigLogLevel ¶
type ConfigLogLevel string
ConfigLogLevel can hold a log level in a configuration struct.
func (*ConfigLogLevel) ConfigFromJSONString ¶
func (cll *ConfigLogLevel) ConfigFromJSONString()
func (ConfigLogLevel) Level ¶
func (cll ConfigLogLevel) Level() string
Level returns the log level string held in cll.
func (*ConfigLogLevel) SetFromString ¶
func (cll *ConfigLogLevel) SetFromString(enc string) error
func (*ConfigLogLevel) UnmarshalJSON ¶
func (cll *ConfigLogLevel) UnmarshalJSON(b []byte) error
type Logger ¶
type Logger interface { // Re-expose base Output for logging events. Output(calldept int, s string) error // Errorf logs an error. Errorf(format string, v ...interface{}) // Fatalf logs an error and exits the program with os.Exit(1). Fatalf(format string, v ...interface{}) // PanicStackf logs an error message and a stacktrace, for use // in panic recovery. PanicStackf(format string, v ...interface{}) // Infof logs an info message. Infof(format string, v ...interface{}) // Debugf logs a debug message. Debugf(format string, v ...interface{}) }
Logger is a simple logger interface with logging at levels.
func NewSimpleLogger ¶
NewSimpleLogger creates a logger logging only up to the given level. The level can be, in order: "error", "info", "debug". It takes an io.Writer.
func NewSimpleLoggerFromMinimalLogger ¶
func NewSimpleLoggerFromMinimalLogger(minLog MinimalLogger, level string) Logger
NewSimpleLoggerFromMinimalLogger creates a logger logging only up to the given level. The level can be, in order: "error", "info", "debug". It takes a value just implementing stlib Logger.Output().
type MinimalLogger ¶
MinimalLogger is the minimal interface required to build a simple logger.