log

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: Apache-2.0 Imports: 10 Imported by: 149

Documentation

Index

Constants

This section is empty.

Variables

A constant exposing all logging levels

View Source
var ErrorKey = "error"

Defines the key when adding errors using WithError.

Functions

func Close

func Close()

Close 关闭

func Debug

func Debug(args ...interface{})

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

func DebugF added in v0.4.0

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

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

func DeferExitHandler

func DeferExitHandler(handler func())

DeferExitHandler prepends a Logrus Exit handler to the list of handlers, call logrus.Exit to invoke all handlers. The handlers will also be invoked when any Fatal log entry is made.

This method is useful when a caller wishes to use logrus to log a fatal message but also needs to gracefully shutdown. An example usecase could be closing database connections, or sending a alert that the application is closing.

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 Exit

func Exit(code int)

Exit runs all the Logrus atexit handlers and then terminates the program using os.Exit(code)

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 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 Panic

func Panic(args ...interface{})

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

func RegisterExitHandler

func RegisterExitHandler(handler func())

RegisterExitHandler appends a Logrus Exit handler to the list of handlers, call logrus.Exit to invoke all handlers. The handlers will also be invoked when any Fatal log entry is made.

This method is useful when a caller wishes to use logrus to log a fatal message but also needs to gracefully shutdown. An example usecase could be closing database connections, or sending a alert that the application is closing.

func Reset

func Reset(transports ...EntryTransporter)

func SetLevel added in v0.5.0

func SetLevel(level Level)

func SetPrefix added in v0.1.1

func SetPrefix(prefix string)

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 Info on the standard logger.

Types

type Builder

type Builder interface {
	Logln(level Level, args ...interface{})
	Log(level Level, args ...interface{})
	Logf(level Level, format string, args ...interface{})
	WithError(err error) Builder
	WithField(key string, value interface{}) Builder
	WithFields(fields Fields) Builder
}

func WithFields

func WithFields(fields Fields) Builder

WithFields 写域

type Complex

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

func NewComplex

func NewComplex(transports ...EntryTransporter) *Complex

func (*Complex)