Documentation ¶
Index ¶
- func Debugf(format string, args ...interface{})
- func Debugln(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Errorln(args ...interface{})
- func Infof(format string, args ...interface{})
- func Infoln(args ...interface{})
- func SetGlobal(i Interface)
- func Setup(logLevel string) error
- func SetupDeduplication(logLevel string, interval time.Duration) error
- func Warnf(format string, args ...interface{})
- func Warnln(args ...interface{})
- type Fields
- type Interface
- type Level
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debugf ¶
func Debugf(format string, args ...interface{})
Debugf convenience function calls the global loggerr.
func Debugln ¶
func Debugln(args ...interface{})
Debugln convenience function calls the global logger.
func Errorf ¶
func Errorf(format string, args ...interface{})
Errorf convenience function calls the global logger.
func Errorln ¶
func Errorln(args ...interface{})
Errorln convenience function calls the global logger.
func Infof ¶
func Infof(format string, args ...interface{})
Infof convenience function calls the global logger.
func Setup ¶
Setup configures a global logrus logger to output to stderr. It populates the standard logrus logger as well as the global logging instance.
func SetupDeduplication ¶
SetupDeduplication should be performed after any other logging setup. For all logs less severe or equal to the given log level (but still higher than the logger's configured log level), these logs will be 'deduplicated'. What this means is that, excluding certain special fields like time, multiple identical log entries will be grouped up and a summary message emitted. For example, instead of:
00:00:00 INFO User 123 did xyz 00:00:10 INFO User 123 did xyz 00:00:25 INFO User 123 did xyz 00:00:55 INFO User 123 did xyz
you would get:
00:00:00 INFO User 123 did xyz 00:01:00 INFO Repeated 3 times: User 123 did xyz
The interval argument controls how long to wait for additional messages to arrive before reporting. Increase it to deduplicate more aggressively, decrease it to lower latency from a log occurring to it appearing. Set it to 0 to pick a sensible default value (recommended). NOTE: For simplicity and efficiency, fields are considered 'equal' if and only if their string representations (%v) are equal.
Types ¶
type Fields ¶
type Fields map[string]interface{}
Fields convenience type for adding multiple fields to a log statement.
type Interface ¶
type Interface interface { Debugf(format string, args ...interface{}) Debugln(args ...interface{}) Infof(format string, args ...interface{}) Infoln(args ...interface{}) Errorf(format string, args ...interface{}) Errorln(args ...interface{}) Warnf(format string, args ...interface{}) Warnln(args ...interface{}) WithField(key string, value interface{}) Interface WithFields(Fields) Interface }
Interface 'unifies' gokit logging and logrus logging, such that the middleware in this repo can be used in projects which use either loggers.
type Level ¶
type Level struct { Logrus logrus.Level Gokit level.Option // contains filtered or unexported fields }
Level is a settable identifier for the minimum level a log entry must be have.
func (Level) MarshalYAML ¶
MarshalYAML implements yaml.Marshaler.
func (*Level) RegisterFlags ¶
RegisterFlags adds the log level flag to the provided flagset.
func (*Level) UnmarshalYAML ¶
UnmarshalYAML implements yaml.Unmarshaler.