Documentation ¶
Index ¶
- Constants
- func Debug(fields ...interface{})
- func Debugf(format string, args ...interface{})
- func EnsureLoggerFromConfig()
- func Error(fields ...interface{})
- func Errorf(format string, args ...interface{})
- func Fatal(fields ...interface{})
- func Fatalf(format string, args ...interface{})
- func Flags() *pflag.FlagSet
- func Info(fields ...interface{})
- func Infof(format string, args ...interface{})
- func NewLogger(level string) error
- func Warn(fields ...interface{})
- func Warnf(format string, args ...interface{})
- type Fields
- type Logger
Constants ¶
View Source
const ( DebugLevel = "debug" InfoLevel = "info" WarnLevel = "warn" ErrorLevel = "error" FatalLevel = "fatal" DefaultCallerSkip = 2 LogLevelConfigKey = "log-level" )
View Source
const DefaultLevel = InfoLevel
Variables ¶
This section is empty.
Functions ¶
func EnsureLoggerFromConfig ¶
func EnsureLoggerFromConfig()
EnsureLoggerFromConfig is a convenience function to quickly create a new logger from the configuration. This requires that the configuration has already be bound from the flags. The function will FATAL if the logger could not be created.
Types ¶
type Logger ¶
type Logger interface { Debug(fields ...interface{}) Debugf(format string, args ...interface{}) Info(fields ...interface{}) Infof(format string, args ...interface{}) Warn(fields ...interface{}) Warnf(format string, args ...interface{}) Error(fields ...interface{}) Errorf(format string, args ...interface{}) Fatal(fields ...interface{}) Fatalf(format string, args ...interface{}) WithFields(keyValues Fields) Logger WithMetadata(ctx context.Context) Logger }
func WithFields ¶
func WithMetadata ¶
Click to show internal directories.
Click to hide internal directories.