Documentation ¶
Index ¶
- type Levels
- func (l Levels) Crit(keyvals ...interface{}) error
- func (l Levels) Debug(keyvals ...interface{}) error
- func (l Levels) Error(keyvals ...interface{}) error
- func (l Levels) Info(keyvals ...interface{}) error
- func (l Levels) Warn(keyvals ...interface{}) error
- func (l Levels) With(keyvals ...interface{}) Levels
- type Option
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Levels ¶
type Levels struct {
// contains filtered or unexported fields
}
Levels provides a leveled logging wrapper around a logger. It has five levels: debug, info, warning (warn), error, and critical (crit). If you want a different set of levels, you can create your own levels type very easily, and you can elide the configuration.
Example ¶
package main import ( "os" "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/levels" ) func main() { logger := levels.New(log.NewLogfmtLogger(os.Stdout)) logger.Debug("msg", "hello") logger.With("context", "foo").Warn("err", "error") }
Output: level=debug msg=hello level=warn context=foo err=error
type Option ¶
type Option func(*Levels)
Option sets a parameter for leveled loggers.
func CritValue ¶
CritValue sets the value for the field used to indicate the critical log level. By default, the value is "crit".
func DebugValue ¶
DebugValue sets the value for the field used to indicate the debug log level. By default, the value is "debug".
func ErrorValue ¶
ErrorValue sets the value for the field used to indicate the error log level. By default, the value is "error".
func InfoValue ¶
InfoValue sets the value for the field used to indicate the info log level. By default, the value is "info".