Documentation
¶
Overview ¶
Package logger handles logging.
This is a thing wrapper around inconshreveable's log15. It additionally brings a configuration format (from YAML) with the ability to log to several destinations.
It also brings some conventions like the presence of "module" in each context to be able to filter logs more easily. However, this convention is not really enforced. Once you have a root logger, create sublogger with New and provide a new value for "module".
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultConfiguration = Configuration{ Level: Lvl(log.LvlInfo), Console: false, Syslog: true, IncludeCaller: false, Format: FormatPlain, }
DefaultConfiguration is the default logging configuration.
Functions ¶
func JSONv1Format ¶
JSONv1Format formats log records as JSONv1 objects separated by newlines.
Types ¶
type Configuration ¶
type Configuration struct { Level Lvl Console bool Syslog bool IncludeCaller bool `yaml:"include_caller,omitempty"` Format LogFormat Files []LogFile }
Configuration if the configuration for logger.
The ability to override log levels for some modules is currently missing.
func (*Configuration) UnmarshalYAML ¶
func (configuration *Configuration) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML parses a logger configuration from YAML.
type LogFile ¶
LogFile represents a log file (name and output format).
func (*LogFile) UnmarshalText ¶
UnmarshalText parses a path to a logfile from YAML.
This returns an absolute cleaned path.
type LogFormat ¶
type LogFormat int
LogFormat represents an output format for LogFile. Currently, only plain text and JSON are supported.
func (*LogFormat) UnmarshalText ¶
UnmarshalText parses a log format from YAML.