log

package
v0.0.0-...-aed9a31 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = &Config{
	FilePrefix:            "debug",
	ConsoleLoggingEnabled: true,
	FileLoggingEnabled:    false,
	Directory:             "./",
	MaxSize:               0,
	MaxBackups:            0,
	MaxAge:                0,
	ShowFileLine:          true,
	LogLevel:              -1,
}

Functions

func CustomTimeEncoder

func CustomTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)

自定义日志输出时间格式

func Init

func Init(config *Config)

Types

type Config

type Config struct {
	FilePrefix            string // 日志前缀
	ConsoleLoggingEnabled bool   // 开启控制台输出
	FileLoggingEnabled    bool   // 开启文件存储
	Directory             string // 日志文件保存目录
	MaxSize               int    // 最大日志大小 MB
	MaxBackups            int    // 最大保留文件数量
	MaxAge                int    // 文件最大保留天数
	ShowFileLine          bool   // 显示代码文件行数
	LogLevel              int8   // 日志等级
}

Configuration for logging

Jump to

Keyboard shortcuts

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