log

package
v0.0.0-...-712d9f1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug() *zerolog.Event

Debug 打印debug级别日志

func Err

func Err(err error) *zerolog.Event

Err 基于err快捷打印一个error日志

func Error

func Error() *zerolog.Event

Error 打印error级别日志

func Fatal

func Fatal() *zerolog.Event

Fatal 打印fatal级别日志

func GetDefault

func GetDefault() zerolog.Logger

func Info

func Info() *zerolog.Event

Info 打印info级别日志

func NewZeroLogger

func NewZeroLogger(conf *Config) zerolog.Logger

func SetDefault

func SetDefault(conf *Config)

func Warn

func Warn() *zerolog.Event

Warn 打印warn级别日志

Types

type Config

type Config struct {
	Level        string `yaml:"level"`         // 日志级别,支持 debug info warn error 默认info
	Filename     string `yaml:"filename"`      // 日志文件名,若文件名为空,则会将日志打印至stdout
	MaxAge       int    `yaml:"max_age"`       // 日志文件最大保存天数,默认为30
	ConsoleFmt   bool   `yaml:"console_fmt"`   // 若此选项为true,打印至stdout时将使用终端格式打印
	ConsoleColor bool   `yaml:"console_color"` // 终端打印日志时是否包含颜色
}

Jump to

Keyboard shortcuts

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