Documentation ¶
Overview ¶
Package levels implements leveled logging on top of Go kit's log package.
Deprecated: Use github.com/go-kit/log/level instead.
Index ¶
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" levels "github.com/crazyscoop/kit/log/deprecated_levels" "github.com/go-kit/log" ) func main() { logger := levels.New(log.NewLogfmtLogger(os.Stdout)) logger.Debug().Log("msg", "hello") logger.With("context", "foo").Warn().Log("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".