log

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitLogger

func InitLogger(filename string, f Formatter)

InitLogger set the output and formatter

func UUID

func UUID() string

UUID always used to identify the request.

Types

type Fields

type Fields = logrus.Fields

Fields type, used to pass to `WithFields`.

type Formatter

type Formatter int

Formatter is for user to specific the log formatter

const (
	// TextFormatter means unordered fields
	TextFormatter Formatter = iota
	// OrderedTextFormatter writes the fields(only but not level&msg) orderly
	OrderedTextFormatter
)

type Logger

type Logger struct {
	*logrus.Entry
}

Logger wraps logrus.Entry. It is the final or intermediate Logrus logging entry. It contains all the fields passed with WithField{,s}.

func GetDefaultLogger

func GetDefaultLogger() *Logger

GetDefaultLogger returns loggers without any fields

func WithFields

func WithFields(fields Fields) *Logger

WithFields returns log.Entry

func (*Logger) Error

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

Error logs a message at level Error

func (*Logger) Errorf

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

Errorf logs a message at level Error

func (*Logger) Fatal

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

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

func (*Logger) Fatalf

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

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

func (*Logger) Info

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

Info logs a message at level Info

func (*Logger) Infof

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

Infof logs a message at level Info

Jump to

Keyboard shortcuts

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