Documentation ¶
Index ¶
- type CompatibilityLogger
- type Data
- type Logger
- func (log Logger) Data(data Data) Logger
- func (log Logger) Debug(message string, fields ...Data)
- func (log Logger) Err(err error) Logger
- func (log Logger) Error(message string, fields ...Data)
- func (log Logger) Fatal(message string, fields ...Data)
- func (log Logger) GetID() string
- func (log Logger) ID(id string) Logger
- func (log Logger) Info(message string, fields ...Data)
- func (log Logger) Root(root Data) Logger
- func (log Logger) Warn(message string, fields ...Data)
- func (log Logger) WithContext(ctx context.Context) context.Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompatibilityLogger ¶
type CompatibilityLogger struct {
// contains filtered or unexported fields
}
CompatibilityLogger follows a common interface that other packages use, so it can be used in places that expect it.
func NewCompatibilityLogger ¶
func NewCompatibilityLogger(log Logger, prefix, defaultMessage string) CompatibilityLogger
func (CompatibilityLogger) Debug ¶
func (l CompatibilityLogger) Debug(args ...interface{})
func (CompatibilityLogger) Error ¶
func (l CompatibilityLogger) Error(args ...interface{})
func (CompatibilityLogger) Fatal ¶
func (l CompatibilityLogger) Fatal(args ...interface{})
func (CompatibilityLogger) Info ¶
func (l CompatibilityLogger) Info(args ...interface{})
func (CompatibilityLogger) Warn ¶
func (l CompatibilityLogger) Warn(args ...interface{})
type Data ¶
type Data map[string]interface{}
Data is a type alias so that it is easy to add additional data to log lines.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is a logger instance that contains necessary info needed when logging.
func FromContext ¶
FromContext returns a Logger from the given context.Context. If there is no attached logger, then this will just return a new Logger instance.
func NewWithLevel ¶
func (Logger) Data ¶
Data adds additional data to every subsequent log line. This data is nested within the "data" field.
func (Logger) Err ¶
Err adds additional an error object to every subsequent log line. This is meant to be immediately chained to emit the log line.
func (Logger) Fatal ¶
Fatal emits a log line with an "fatal" log level. It also calls os.Exit(1) afterwards.
func (Logger) Root ¶
Root adds additional data to every subsequent log line. This data is added to the root of the JSON line.