log

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2020 License: MIT Imports: 3 Imported by: 0

README

log

provides level distinguish and error detail logging.

These are the different logging levels.

PanicLevel level

highest level of severity. Logs and then calls panic with the message passed to Debug, Info, ...

FatalLevel level

Logs and then calls os.Exit(1). It will exit even if the logging level is set to Panic.

ErrorLevel level

Used for errors that should definitely be noted. Commonly used for hooks to send errors to an error tracking service.

WarnLevel level

Non-critical entries that deserve eyes.

InfoLevel level

General operational entries about what's going on inside the application.

DebugLevel level

Usually only enabled when debugging. Very verbose logging.

Documentation

Index

Constants

View Source
const (
	// PanicLevel level, highest level of severity. Logs and then calls panic with the
	// message passed to Debug, Info, ...
	PanicLevel = logrus.PanicLevel
	// FatalLevel level. Logs and then calls `os.Exit(1)`. It will exit even if the
	// logging level is set to Panic.
	FatalLevel = logrus.FatalLevel
	// ErrorLevel level. Logs. Used for errors that should definitely be noted.
	// Commonly used for hooks to send errors to an error tracking service.
	ErrorLevel = logrus.ErrorLevel
	// WarnLevel level. Non-critical entries that deserve eyes.
	WarnLevel = logrus.WarnLevel
	// InfoLevel level. General operational entries about what's going on inside the
	// application.
	InfoLevel = logrus.InfoLevel
	// DebugLevel level. Usually only enabled when debugging. Very verbose logging.
	DebugLevel = logrus.DebugLevel
)

These are the different logging levels. You can set the logging level to log on your instance of logger.

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

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

func DebugStack

func DebugStack(err error)

DebugStack a error's detail 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 Error

func Error(args ...interface{})

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

func ErrorStack

func ErrorStack(err error)

ErrorStack a error's detail 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 Fatal

func Fatal(args ...interface{})

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

func FatalStack

func FatalStack(err error)

FatalStack a error's detail 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 Info

func Info(args ...interface{})

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

func InfoStack

func InfoStack(err error)

InfoStack a error's detail 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 Panic

func Panic(args ...interface{})

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

func PanicStack

func PanicStack(err error)

PanicStack logs a error's detail 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 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 SetLevel

func SetLevel(level logger.Level)

SetLevel sets the standard logger level.

func SetOutput

func SetOutput(out io.Writer)

SetOutput sets the standard logger output.

func Warn

func Warn(args ...interface{})

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

func WarnStack

func WarnStack(err error)

WarnStack a error's detail 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.

Types

type Logger

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

Logger is a wrapper of logrus logger type.

func New

func New() *Logger

New returns a Logger instance with logrus default settings.

func (*Logger) Debug

func (l *Logger) Debug(args ...interface{})

Debug log the debug level message.

func (*Logger) DebugStack

func (l *Logger) DebugStack(err error)

DebugStack log the debug level error detail.

func (*Logger) Debugf

func (l *Logger) Debugf(format string, args ...interface{})

Debugf log the debug level message.

func (*Logger) Error

func (l *Logger) Error(args ...interface{})

Error log the error level message.

func (*Logger) ErrorStack

func (l *Logger) ErrorStack(err error)

ErrorStack log the error level error detail.

func (*Logger) Errorf

func (l *Logger) Errorf(format string, args ...interface{})

Errorf log the error level message.

func (*Logger) Fatal

func (l *Logger) Fatal(args ...interface{})

Fatal log the fatal level message then fatal.

func (*Logger) FatalStack

func (l *Logger) FatalStack(err error)

FatalStack log the fatal level error detail.

func (*Logger) Fatalf

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

Fatalf log the fatal level message then fatal.

func (*Logger) Info

func (l *Logger) Info(args ...interface{})

Info log the info level message.

func (*Logger) InfoStack

func (l *Logger) InfoStack(err error)

InfoStack log the info level error detail.

func (*Logger) Infof

func (l *Logger) Infof(format string, args ...interface{})

Infof log the info level message.

func (*Logger) Panic

func (l *Logger) Panic(args ...interface{})

Panic log the panic level message then panic.

func (*Logger) PanicStack

func (l *Logger) PanicStack(err error)

PanicStack log the panic level error detail.

func (*Logger) Panicf

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

Panicf log the panic level message then panic.

func (*Logger) SetLevel

func (l *Logger) SetLevel(level logrus.Level)

SetLevel sets the logger level.

func (*Logger) SetOutput

func (l *Logger) SetOutput(out io.Writer)

SetOutput sets the logger output.

func (*Logger) Warn

func (l *Logger) Warn(args ...interface{})

Warn log the warn level message.

func (*Logger) WarnStack

func (l *Logger) WarnStack(err error)

WarnStack log the warn level error detail.

func (*Logger) Warnf

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

Warnf log the warn level message.

Jump to

Keyboard shortcuts

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