Documentation
¶
Index ¶
- func OpenOutput(location string) (io.Writer, error)
- type CompositeLogger
- func (l *CompositeLogger) Add(location string, format string, level string) error
- func (l *CompositeLogger) Fatal(msg interface{})
- func (l *CompositeLogger) Info(msg interface{})
- func (l *CompositeLogger) InfoWithFields(msg interface{}, fields map[string]interface{})
- func (l *CompositeLogger) Warn(msg interface{})
- func (l *CompositeLogger) WarnWithFields(msg interface{}, fields map[string]interface{})
- type LogConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CompositeLogger ¶
CompositeLogger is a struct containing an array of loggers.
func NewCompositeLogger ¶
func NewCompositeLogger(logConfigs []*LogConfig) (*CompositeLogger, error)
NewCompositeLogger returns a composite logger for an array of log configurations. If there is an error, returns the error.
func NewDefaultLogger ¶
func NewDefaultLogger() (*CompositeLogger, error)
NewDefaultLogger returns a default composite logger, with stdout/info and stderr/warning. If there is an error, returns the error.
func (*CompositeLogger) Add ¶
func (l *CompositeLogger) Add(location string, format string, level string) error
Add adds a new logger to the composite logger, specified by the parameters. Returns an error, if any.
func (*CompositeLogger) Fatal ¶
func (l *CompositeLogger) Fatal(msg interface{})
Info logs a message with level FATAL to all loggers.
func (*CompositeLogger) Info ¶
func (l *CompositeLogger) Info(msg interface{})
Info logs a message with level INFO to all loggers.
func (*CompositeLogger) InfoWithFields ¶
func (l *CompositeLogger) InfoWithFields(msg interface{}, fields map[string]interface{})
InfoWithFields logs a message with level INFO and a map of fields to all loggers.
func (*CompositeLogger) Warn ¶
func (l *CompositeLogger) Warn(msg interface{})
Info logs a message with level WARN to all loggers.
func (*CompositeLogger) WarnWithFields ¶
func (l *CompositeLogger) WarnWithFields(msg interface{}, fields map[string]interface{})
InfoWithFields logs a message with level WARN and a map of fields to all loggers.
type LogConfig ¶
type LogConfig struct { Location string `json:"location" bson:"location" yaml:"location" hcl:"location"` // location of the log Level string `json:"level" bson:"level" yaml:"level" hcl:"level"` // level of the log: INFO, WARN, DEBUG, etc. Format string `json:"format" bson:"format" yaml:"format" hcl:"format"` // text or json }
LogConfig is a struct containing the configuration for an individual log.