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模式
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 {
Log *zap.Logger // 日志对象
Sugar *zap.SugaredLogger // sugar日志对象
// 日志方法
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{})
// contains filtered or unexported fields
}
Log 日志核心对象
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
z01_hello
command
|
|
|
libs
|
|
|
atomic/internal/gen-atomicint
command
gen-atomicint generates an atomic wrapper around an integer type.
|
gen-atomicint generates an atomic wrapper around an integer type. |
|
atomic/internal/gen-atomicwrapper
command
gen-atomicwrapper generates wrapper types around other atomic types.
|
gen-atomicwrapper generates wrapper types around other atomic types. |
|
multierr
Package multierr allows combining one or more errors together.
|
Package multierr allows combining one or more errors together. |
|
zap
Package zap provides fast, structured, leveled logging.
|
Package zap provides fast, structured, leveled logging. |
|
zap/internal/readme
command
|
|
|
zap/zapgrpc
Package zapgrpc provides a logger that is compatible with grpclog.
|
Package zapgrpc provides a logger that is compatible with grpclog. |
|
zap/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.