Documentation
¶
Overview ¶
logging implements a logs reporter.
Index ¶
- type Config
- type LogDestinationConfig
- type Reporter
- func (r *Reporter) Crit(msg string, ctx ...interface{})
- func (r *Reporter) Debug(msg string, ctx ...interface{})
- func (r *Reporter) Error(msg string, ctx ...interface{})
- func (r *Reporter) Handler() log15.Handler
- func (r *Reporter) Info(msg string, ctx ...interface{})
- func (r *Reporter) SetHandler(h log15.Handler)
- func (r *Reporter) Start(_ context.Context) error
- func (r *Reporter) Stop(_ context.Context) error
- func (r *Reporter) Warn(msg string, ctx ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Destinations represents the list of logging destinations.
Destinations []*LogDestinationConfig `yaml:"destinations"`
// Context represents user-defined context key/values to be injected into log records.
Context map[string]string `yaml:"context"`
// ReportErrors represents a flag indicating whether to automatically send error-level and higher
// log messages to the errors reporter (the errors reporter has to be configured).
ReportErrors bool `yaml:"report_errors"`
// Debug represents a flags indicating whether to enable internal reporter activity logging.
// This is mainly for debug purposes.
Debug bool `yaml:"debug"`
}
Config represents a logging reporter configuration.
type LogDestinationConfig ¶
type LogDestinationConfig struct {
// Type represents the destination type (file|console|syslog).
Type string `yaml:"type"`
// Destination represents the log destination depending on the type:
// - For type "file", is must be a filesystem path
// - For "console", it is ignored
// - For type "syslog", it can be either empty (local syslog) or a net.Dial compatible string for remote syslog
Destination string `yaml:"destination"`
// Level represents the highest message severity level to report (crit..debug).
Level string `yaml:"level"`
// Format represents the format to apply to logged messages (plain|json).
Format string `yaml:"format"`
}
LogDestinationConfig represents a logging reporter destination.
type Reporter ¶
Reporter represents a logging reporter instance.
func (*Reporter) SetHandler ¶
SetHandler sets the logging reporter's log15.Handler.
Click to show internal directories.
Click to hide internal directories.