logrus

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// RequestIDKey RequestID fields
	RequestIDKey = "x-reqid"
)

Functions

func DecorateLog

func DecorateLog(logger *log.Entry) *log.Entry

DecorateLog ..

func GenReqID

func GenReqID() string

GenReqID ..

func SetFormat

func SetFormat(format string, logger *Logger)

SetFormat ..

func SetLogLevel

func SetLogLevel(level string, logger *Logger)

SetLogLevel ..

func SetOutput

func SetOutput(output string, logger *Logger)

SetOutput ..

func SetOutputFile

func SetOutputFile(fileName string, logger *Logger)

SetOutputFile set logger file

Types

type Hook

type Hook interface {
	Levels() []log.Level
	Fire(*log.Entry) error
}

Hook ..

type LogMessage

type LogMessage struct {
	Level  string
	Format string
	Data   []interface{}
	Entry  *log.Entry
}

LogMessage async logger data

type Logger

type Logger struct {
	LogEntry *log.Entry
	// contains filtered or unexported fields
}

Logger logrus realize

var (
	StdLog *Logger
)

logger constant

func New

func New(o ...interface{}) *Logger

New this function is recommended to create a new logger object

func NewEmptyLoggerWithFields

func NewEmptyLoggerWithFields(fields map[string]interface{}) *Logger

NewEmptyLoggerWithFields ..

func NewLogger

func NewLogger(entrys ...*log.Entry) *Logger

NewLogger ..

func (*Logger) AddHook

func (logger *Logger) AddHook(hook Hook) *Logger

AddHook ..

func (*Logger) Debug

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

Debug ..

func (*Logger) Debugf

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

Debugf ..

func (*Logger) Error

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

Error ..

func (*Logger) Errorf

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

Errorf ..

func (*Logger) Fatal

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

Fatal ..

func (*Logger) Fatalf

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

Fatalf ..

func (*Logger) Info

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

Info ..

func (*Logger) Infof

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

Infof ..

func (*Logger) Panic

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

Panic ..

func (*Logger) Panicf

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

Panicf ..

func (*Logger) ReqID

func (logger *Logger) ReqID() string

ReqID ..

func (*Logger) SetLevel

func (logger *Logger) SetLevel(level log.Level)

SetLevel ..

func (*Logger) SetOutput

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

SetOutput sets the standard logger output.

func (*Logger) Warn

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

Warn ..

func (*Logger) Warnf

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

Warnf ..

func (*Logger) WithFields

func (logger *Logger) WithFields(fields map[string]interface{}) *log.Entry

WithFields ..

func (*Logger) Xput

func (logger *Logger) Xput(logs []string)

Xput ..

type LoggerFields

type LoggerFields map[string]interface{}

LoggerFields ..

Jump to

Keyboard shortcuts

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