Documentation

Index

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 Infoln

            func Infoln(args ...interface{})

              Infoln convenience function calls the global logger.

              func SetGlobal

              func SetGlobal(i Interface)

                SetGlobal sets the global logger.

                func Setup

                func Setup(logLevel string) error

                  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

                  func SetupDeduplication(logLevel string, interval time.Duration) error

                    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.

                    func Warnf

                    func Warnf(format string, args ...interface{})

                      Warnf convenience function calls the global logger.

                      func Warnln

                      func Warnln(args ...interface{})

                        Warnln convenience function calls the global logger.

                        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.

                            func Global

                            func Global() Interface

                              Global returns the global logger.

                              func GoKit

                              func GoKit(logger log.Logger) Interface

                                GoKit wraps an existing gokit Logger.

                                func Logrus

                                func Logrus(l *logrus.Logger) Interface

                                  Logrus wraps an existing Logrus logger.

                                  func NewGoKit

                                  func NewGoKit(l Level) Interface

                                    NewGoKit creates a new Interface backed by a GoKit logger

                                    func NewLogrus

                                    func NewLogrus(level Level) Interface

                                      NewLogrus makes a new Interface backed by a logrus logger

                                      func Noop

                                      func Noop() Interface

                                        Noop logger.

                                        func WithField

                                        func WithField(key string, value interface{}) Interface

                                          WithField convenience function calls the global logger.

                                          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

                                            func (l Level) MarshalYAML() (interface{}, error)

                                              MarshalYAML implements yaml.Marshaler.

                                              func (*Level) RegisterFlags

                                              func (l *Level) RegisterFlags(f *flag.FlagSet)

                                                RegisterFlags adds the log level flag to the provided flagset.

                                                func (*Level) Set

                                                func (l *Level) Set(s string) error

                                                  Set updates the value of the allowed level. Implments flag.Value.

                                                  func (*Level) String

                                                  func (l *Level) String() string

                                                  func (*Level) UnmarshalYAML

                                                  func (l *Level) UnmarshalYAML(unmarshal func(interface{}) error) error

                                                    UnmarshalYAML implements yaml.Unmarshaler.