Documentation
¶
Overview ¶
Package logger wires LogLayer to console or file sinks.
Index ¶
Constants ¶
View Source
const ( // DefaultBufferSize is the async queue capacity when unset. DefaultBufferSize = 4096 // DefaultFlushTimeout bounds shutdown and fatal-log flushing. DefaultFlushTimeout = 5 * time.Second )
Variables ¶
View Source
var ( // ErrInvalidLevel reports an unknown level. ErrInvalidLevel = errors.New("logger: invalid level (want trace|debug|info|warn|error|fatal|panic)") // ErrInvalidOutput reports an unknown output. ErrInvalidOutput = errors.New("logger: invalid output (want console|file)") // ErrInvalidFormat reports an unknown format. ErrInvalidFormat = errors.New("logger: invalid format (want pretty|structured)") // ErrPrettyRequiresConsole reports pretty output requested for a file. ErrPrettyRequiresConsole = errors.New("logger: pretty format requires console output") // ErrFileRequired reports file output without a path. ErrFileRequired = errors.New("logger: file output requires a file path") )
Errors returned by New.
Functions ¶
func QueueLogger ¶
QueueLogger adapts the application logger to the queue logger interface.
Types ¶
type Logger ¶
type Logger = *loglayer.LogLayer
Logger is the application logging contract.
type Options ¶
type Options struct {
// Level accepts trace, debug, info, warn, error, fatal, or panic.
Level string
// Output: "console" (default) or "file".
Output string
// Format accepts structured (JSON) or pretty (console only).
Format string
// NoColor disables colors in pretty output.
NoColor bool
// File is the path for file output.
File string
// Buffer is async queue capacity. Zero uses DefaultBufferSize.
Buffer int
}
Options selects the sink and format for New.
Click to show internal directories.
Click to hide internal directories.