Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v1.0.3
type Config struct {
Debug bool `env:"debug" yaml:"debug" json:"debug"` // 是否为debug模式
LogLevel string `env:"log_level" yaml:"log_level" json:"log_level"` // 日志级别
IsWriteDebug bool `env:"is_write_debug" yaml:"is_write_debug" json:"is_write_debug"` // 是否将debug日志写入文件
IsShowConsole bool `env:"is_show_console" yaml:"is_show_console" json:"is_show_console"` // 是否在控制台展示
OpenJsonLog bool `env:"open_json_log" yaml:"open_json_log" json:"open_json_log"` // 是否开启json日志格式
OpenFileName bool `env:"open_file_name" yaml:"open_file_name" json:"open_file_name"` // 是否输出文件名和行号
LogFilePath string `env:"log_file_path" yaml:"log_file_path" json:"log_file_path"` // 日志路径
MaxSize uint `env:"max_size" yaml:"max_size" json:"max_size"` // 日志最大保存多少M
MaxBackups uint `env:"max_backups" yaml:"max_backups" json:"max_backups"` // 日志保留多少个备份
MaxAge uint `env:"max_age" yaml:"max_age" json:"max_age"` // 最多保留多少天日志
Compress bool `env:"compress" yaml:"compress" json:"compress"` // 是否压缩
}
Config zap日志配置核心对象
type Log ¶
type Log struct {
Config *Config // 配置对象
// 日志方法
Debug func(msg string, args ...interface{})
Info func(msg string, args ...interface{})
Warning func(msg string, args ...interface{})
Error func(msg string, args ...interface{})
Panic func(msg string, args ...interface{})
Fatal func(msg string, args ...interface{})
}
Log 日志核心对象
var (
Tmp *Log
)
func NewWithDebug ¶ added in v1.3.4
NewWithDebug 根据debug值和日志路径创建日志对象
Directories
¶
| Path | Synopsis |
|---|---|
|
internal/gen-atomicint
command
gen-atomicint generates an atomic wrapper around an integer type.
|
gen-atomicint generates an atomic wrapper around an integer type. |
|
internal/gen-atomicwrapper
command
gen-atomicwrapper generates wrapper types around other atomic types.
|
gen-atomicwrapper generates wrapper types around other atomic types. |
|
Package zap provides fast, structured, leveled logging.
|
Package zap provides fast, structured, leveled logging. |
|
internal/readme
command
|
|
|
zapgrpc
Package zapgrpc provides a logger that is compatible with grpclog.
|
Package zapgrpc provides a logger that is compatible with grpclog. |
|
zaptest/observer
Package observer provides a zapcore.Core that keeps an in-memory, encoding-agnostic representation of log entries.
|
Package observer provides a zapcore.Core that keeps an in-memory, encoding-agnostic representation of log entries. |
Click to show internal directories.
Click to hide internal directories.