commonlog

package
v0.0.0-...-e3aa4fd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2020 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHook

func AddHook(hook logrus.Hook)

AddHook adds hook to Prometheus' original logger.

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

func NewErrorLogger() *log.Logger

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 Panic

func Panic(args ...interface{})

Panic logs a message at level Panic on the standard logger.

func SetFormatter

func SetFormatter(formatter logrus.Formatter)

SetFormatter set custom formatter to logger

func SetLevel

func SetLevel(level string)

SetLevel set logrus logging level

func SetLogConfig

func SetLogConfig(config Config)

SetLogConfig set config for logrus

func SetOutput

func SetOutput(output io.Writer)

SetOutput set logrus logging output

func Warn

func Warn(args ...interface{})

Warn logs a message at level Warn on the standard logger.

func Warnf

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

Warnf logs a message at level Warn on the standard logger.

func Warnln

func Warnln(args ...interface{})

Warnln logs a message at level Warn on the standard logger.

Types

type Config

type Config struct {
	LogLevel  string
	ShortPath bool
	Formatter logrus.Formatter
}

Config used for logrus config

type Fields

type Fields logrus.Fields

Fields wrapper for logrus fields

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{})

	Panic(...interface{})

	WithField(key string, value interface{}) Logger
	WithFields(fields logrus.Fields) Logger

	SetLevel(string) error
}

Logger is the interface for loggers used in the Prometheus components.

func Base

func Base() Logger

Base returns the default Logger logging to

func NewLogger

func NewLogger(w io.Writer) Logger

NewLogger returns a new Logger logging to out.

func NewNopLogger

func NewNopLogger() Logger

NewNopLogger returns a logger that discards all log messages.

func WithField

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

WithField adds a field to the logger.

func WithFields

func WithFields(fields logrus.Fields) Logger

WithFields adds multiple fields to the logger.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL