Documentation
¶
Index ¶
Constants ¶
View Source
const ( // LevelDebug provides the most verbose logging, allowing logs for debug, info, // warn, and error. LevelDebug Level = iota // LevelInfo is the default log level. It allows logs for info, warn, and // error. LevelInfo // LevelWarn is reserved for logging warnings and errors. LevelWarn // LevelError provides the least verbose logging, allowing logs only for // errors. LevelError // FormatJSON encodes each log entry as a single JSON object. FormatJSON Format = iota // FormatLogfmt encodes each log entry in logfmt format. FormatLogfmt // FormatNop will suppress logging output entirely. FormatNop )
Variables ¶
View Source
var ( // ErrInvalidLevel will be returned when the level given to the WirhLevel // option is invalid. ErrInvalidLevel = errors.New("Invalid Level") // ErrInvalidFormat will be returned when the format given to the WithFormat // options is invalid. ErrInvalidFormat = errors.New("Invvalid Format") // ErrInvalidOutput will be returned when the output writer given to WithOuput // is nil. ErrInvalidOutput = errors.New("Invalid Format") )
Functions ¶
This section is empty.
Types ¶
type Format ¶
type Format uint
Format defines the output formats of the logger. Supported formats are FormatJSON (the default), FormatLogfmt, and FormatNop (no loggin).
type Level ¶
type Level uint
Level defines the logging levels available to the Logger, with a level of debug logging all message and error logging only error message.
type Logger ¶
type Logger interface { Debug(...interface{}) Info(...interface{}) Warn(...interface{}) Error(...interface{}) }
Logger is the interface for all logging operations.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option provides for Logger configuration.
func WithFormat ¶
WithFormat allows the format to be configured. The default format is FormatJSON.
func WithOutput ¶
WithOutput allows the format to be configured. The default writer is os.Stderr.
Click to show internal directories.
Click to hide internal directories.