Documentation
¶
Index ¶
- func AddContextFields(ctx context.Context, fields Fields)
- func AddFlags(a *kingpin.Application)
- func AddHook(hook logrus.Hook)
- func AddToContext(ctx context.Context) context.Context
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Debugln(args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Errorln(args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Fatalln(args ...interface{})
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func Infoln(args ...interface{})
- func NewErrorLogger() *log.Logger
- func SetJSONFormat(ts string)
- func SetTimestampFormat(ts string)
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- func Warnln(args ...interface{})
- type Fields
- type Logger
- func Base() Logger
- func FromContext(ctx context.Context) Logger
- func NewLogger(w io.Writer) Logger
- func NewNopLogger() Logger
- func With(key string, value interface{}) Logger
- func WithField(key string, value interface{}) Logger
- func WithFields(fields Fields) Logger
- func WithMetadata(args ...interface{}) Logger
- func WithStructs(args ...interface{}) Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddContextFields ¶
AddContextFields adds fields to be logged to the context
func AddFlags ¶
func AddFlags(a *kingpin.Application)
AddFlags adds the flags used by this package to the Kingpin application. To use the default Kingpin application, call AddFlags(kingpin.CommandLine)
func AddToContext ¶
AddToContext creates the context entry if it does not exist
func Debug ¶
func Debug(args ...interface{})
Debug logs a message at level Debug on the standard logger.
func Debugf ¶
func Debugf(format string, args ...interface{})
Debugf logs a message at level Debug on the standard logger.
func Debugln ¶
func Debugln(args ...interface{})
Debugln logs a message at level Debug on the standard logger.
func Error ¶
func Error(args ...interface{})
Error logs a message at level Error on the standard logger.
func Errorf ¶
func Errorf(format string, args ...interface{})
Errorf logs a message at level Error on the standard logger.
func Errorln ¶
func Errorln(args ...interface{})
Errorln logs a message at level Error on the standard logger.
func Fatal ¶
func Fatal(args ...interface{})
Fatal logs a message at level Fatal on the standard logger.
func Fatalf ¶
func Fatalf(format string, args ...interface{})
Fatalf logs a message at level Fatal on the standard logger.
func Fatalln ¶
func Fatalln(args ...interface{})
Fatalln logs a message at level Fatal on the standard logger.
func Info ¶
func Info(args ...interface{})
Info logs a message at level Info on the standard logger.
func Infof ¶
func Infof(format string, args ...interface{})
Infof logs a message at level Info on the standard logger.
func Infoln ¶
func Infoln(args ...interface{})
Infoln logs a message at level Info on the standard logger.
func NewErrorLogger ¶
NewErrorLogger returns a log.Logger that is meant to be used in the ErrorLog field of an http.Server to log HTTP server errors.
func SetJSONFormat ¶
func SetJSONFormat(ts string)
SetJSONFormat sets the json format for the underlying logrus instance.
func SetTimestampFormat ¶
func SetTimestampFormat(ts string)
SetTimestampFormat sets the timestamp format for the underlying logrus instance.
func Warn ¶
func Warn(args ...interface{})
Warn logs a message at level Warn on the standard logger.
Types ¶
type Logger ¶
type Logger interface { Debug(...interface{}) Debugln(...interface{}) Debugf(string, ...interface{}) Info(...interface{}) Infoln(...interface{}) Infof(string, ...interface{}) Warn(...interface{}) Warnln(...interface{}) Warnf(string, ...interface{}) Error(...interface{}) Errorln(...interface{}) Errorf(string, ...interface{}) Fatal(...interface{}) Fatalln(...interface{}) Fatalf(string, ...interface{}) With(key string, value interface{}) Logger WithField(key string, value interface{}) Logger WithFields(fields Fields) Logger WithStructs(args ...interface{}) Logger WithMetadata(args ...interface{}) Logger SetFormat(string) error SetLevel(string) error }
Logger is the interface for loggers used in the Prometheus components.
func FromContext ¶
FromContext extracts a Logger from context returning base if not set
func NewNopLogger ¶
func NewNopLogger() Logger
NewNopLogger returns a logger that discards all log messages.
func WithMetadata ¶
func WithMetadata(args ...interface{}) Logger
WithMetadata adds all fields of structs to a Logger.
func WithStructs ¶
func WithStructs(args ...interface{}) Logger
WithStructs adds all fields of structs to a Logger.