logrus

package
v0.0.0-...-ce5093a Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(opts ...Option)

func New

func New(opts ...Option) *logrus.Logger

Types

type CallerPrettyfier

type CallerPrettyfier func(*runtime.Frame) (function string, file string)

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithContextFields

func WithContextFields(fields ...string) Option

WithContextFields logrus.WithContext() 打印 ctx 中的字段

func WithDisableCaller

func WithDisableCaller() Option

WithDisableCaller 关闭日志打印调用行号

func WithDisableStdout

func WithDisableStdout() Option

WithDisableStdout 关闭日志终端打印

func WithFileLog

func WithFileLog(logDir, fileName string) Option

WithFileLog 设置文件日志信息

func WithLevel

func WithLevel(level string) Option

WithLevel 设置日志级别: trace,debug,info,warn,error,fatal,panic

func WithMaxAge

func WithMaxAge(maxAge time.Duration) Option

WithMaxAge 设置日志最大保留时长

type ReadableFormatter

type ReadableFormatter struct {
	TimestampFormat  string
	DisableSorting   bool
	CallerPrettyfier CallerPrettyfier
	CtxFields        []string
}

func (*ReadableFormatter) Format

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

Jump to

Keyboard shortcuts

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