Documentation
¶
Index ¶
Constants ¶
View Source
const ( // NoPathEncoderType 不打印文件路径 NoPathEncoderType = iota // ShortPathEncoderType 打印段文件路径 ShortPathEncoderType // FullPathEncoderType 打印完整文件路径 FullPathEncoderType )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger 定义了一个 zap 日志记录器
type Option ¶
type Option struct {
FilePath string // 如果为空则表示不向文件打印日志
LogLevel zap.AtomicLevel
ConsoleLogger bool // 是否打印控制台日志
CallSkip int // 跳过调用函数的数量
Stack bool // 是否打印堆栈
PathEncoderType PathEncoderType // 文件路径编码类型:不打印、段路径编码、全路径编码
ConsoleSeparator string // 日志字段的分隔符
MaxSize int // 每个日志文件保存的最大尺寸 单位:M
MaxBackups int // 日志文件最多保存多少个备份
MaxAge int // 文件最多保存多少天
}
Option 包含 zap 日志库的可定制选项
func NewDefaultOption ¶
NewDefaultOption 返回默认的 zap 日志选项
func (*Option) SetLogLevel ¶
SetLogLevel 动态设置 zap 日志的级别
Click to show internal directories.
Click to hide internal directories.