log

package
v0.0.0-...-006488c Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2019 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHook

func AddHook(hook logrus.Hook)

AddHook adds a hook to the standard logger hooks.

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 then the process will exit with status set to 1.

func Fatalf

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

Fatalf logs a message at level Fatal on the standard logger then the process will exit with status set to 1.

func Fatalln

func Fatalln(args ...interface{})

Fatalln logs a message at level Fatal on the standard logger then the process will exit with status set to 1.

func GetLevel

func GetLevel() logrus.Level

GetLevel returns the standard logger level.

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 IsLevelEnabled

func IsLevelEnabled(level logrus.Level) bool

IsLevelEnabled checks if the log level of the standard logger is greater than the level param

func Panic

func Panic(args ...interface{})

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

func Panicf

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

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

func Panicln

func Panicln(args ...interface{})

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

func Print

func Print(args ...interface{})

Print logs a message at level Info on the standard logger.

func Printf

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

Printf logs a message at level Info on the standard logger.

func Println

func Println(args ...interface{})

Println logs a message at level Info on the standard logger.

func SetLevel

func SetLevel(level logrus.Level)

SetLevel sets the standard logger level.

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 Warning

func Warning(args ...interface{})

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

func Warningf

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

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

func Warningln

func Warningln(args ...interface{})

Warningln 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.

func WithError

func WithError(err error) *logrus.Entry

WithError creates an entry from the standard logger and adds an error to it, using the value defined in ErrorKey as key.

func WithField

func WithField(key string, value interface{}) *logrus.Entry

WithField creates an entry from the standard logger and adds a field to it. If you want multiple fields, use `WithFields`.

Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal or Panic on the Entry it returns.

func WithFields

func WithFields(fields logrus.Fields) *logrus.Entry

WithFields creates an entry from the standard logger and adds multiple fields to it. This is simply a helper for `WithField`, invoking it once for each field.

Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal or Panic on the Entry it returns.

func WithTime

func WithTime(t time.Time) *logrus.Entry

WithTime creats an entry from the standard logger and overrides the time of logs generated with it.

Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal or Panic on the Entry it returns.

Types

type ColoredField

type ColoredField struct {
	// contains filtered or unexported fields
}

ColoredField allows passage as field to colorize the output to the given color.

func ColoredStatus

func ColoredStatus(status int) ColoredField

ColoredStatus returns the status in color.

type HTTPRequestLogger

type HTTPRequestLogger struct {
	// contains filtered or unexported fields
}

HTTPRequestLogger is the logger for http requests that implements negroni.Logger

func GetStandardHTTPRequestLogger

func GetStandardHTTPRequestLogger() HTTPRequestLogger

GetStandardHTTPRequestLogger gets the HTTPRequestLogger based on the standard logger.

func (HTTPRequestLogger) ServeHTTP

func (l HTTPRequestLogger) ServeHTTP(rw http.ResponseWriter, req *http.Request, next http.HandlerFunc)

type Logger

type Logger struct {
	logrus.Logger
}

Logger is the type of logger for the app.

func GetStandardLogger

func GetStandardLogger() *Logger

GetStandardLogger gets the default logger for the program.

type TextFormatter

type TextFormatter struct{}

TextFormatter formats logs into text.

func (*TextFormatter) Format

func (f *TextFormatter) Format(entry *logrus.Entry) ([]byte, error)

Format renders a single log entry. TODO format stacktrace fields specially

Jump to

Keyboard shortcuts

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