logger

package
v0.0.0-...-8eabb82 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLogLevel

func GetLogLevel(level string) []logrus.Level

GetLogLevel 获取日志等级

可能的值有

"trace","debug","info","warn","warn","error"

func GetLogLevelColorCode

func GetLogLevelColorCode(level logrus.Level) string

GetLogLevelColorCode 获取日志等级对应色彩code

Types

type LocalHook

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

LocalHook logrus本地钩子

func NewLocalHook

func NewLocalHook(args any, consoleFormatter, fileFormatter logrus.Formatter, levels ...logrus.Level) *LocalHook

NewLocalHook 初始化本地日志钩子实现

func (*LocalHook) Fire

func (hook *LocalHook) Fire(entry *logrus.Entry) error

Fire ref: logrus/hooks.go impl Hook interface

func (*LocalHook) Levels

func (hook *LocalHook) Levels() []logrus.Level

Levels ref: logrus/hooks.go impl Hook interface

func (*LocalHook) SetFormatter

func (hook *LocalHook) SetFormatter(consoleFormatter, fileFormatter logrus.Formatter)

SetFormatter 设置日志格式

func (*LocalHook) SetPath

func (hook *LocalHook) SetPath(path string)

SetPath 设置日志写入路径

func (*LocalHook) SetWriter

func (hook *LocalHook) SetWriter(writer io.Writer)

SetWriter 设置Writer

type LogFormat

type LogFormat struct {
	EnableColor      bool
	CallerPrettyfier func(*runtime.Frame) (function string, file string)
}

LogFormat

func (LogFormat) Format

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

Format implements logrus.Formatter

Jump to

Keyboard shortcuts

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