Documentation
¶
Index ¶
Constants ¶
View Source
const ( // LogLevelDebug denotes debug messages LogLevelDebug = "debug" // LogLevelInfo denotes info messages LogLevelInfo = "info" // LogLevelWarn denotes warn messages LogLevelWarn = "warn" // LogLevelError denotes error messages LogLevelError = "error" )
View Source
const (
ErrorKey = "error"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LogContext ¶
type LogContext map[string]interface{}
LogContext defines the context for the logs.
type Logger ¶
type Logger interface {
// With adds a logContext to the logger.
With(LogContext) Logger
// WithError adds an Error to the logger.
WithError(error) Logger
// Context returns the current context
Context() LogContext
// Timed add a timed log context.
Timed() Logger
// Debugf logs a formatted string as a debug message.
Debugf(format string, args ...interface{})
// Errorf logs a formatted string as an error message.
Errorf(format string, args ...interface{})
// Infof logs a formatted string as an info message.
Infof(format string, args ...interface{})
// Warnf logs a formatted string as an warning message.
Warnf(format string, args ...interface{})
}
Logger defines an object able to log messages.
func NewNilLogger ¶
func NewNilLogger() Logger
NewNilLogger returns a logger that performs no action.
func NewTestLogger ¶
func NewTestLogger() Logger
NewTestLogger creates a logger for testing purposes.
Click to show internal directories.
Click to hide internal directories.