Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var LoggerLevel = zap.NewAtomicLevel()
动态设置 level 变量 是全局参数,动态改变level后, 只影响改变时候处在的【作用域内的 logger】(不管是 父级 还是 兄弟 子孙 )
Functions ¶
Types ¶
type Logger ¶
type Logger struct { Level string `toml:"level" env:"SET_LOGGER_Level"` Format string `toml:"format" env:"SET_LOGGER_FORMAT"` // 日志格式:plain, json; WriteTo string `toml:"writeto" env:"SET_LOGGER_WRITETO"` // 写到: file console consolefile LogPath string `toml:"logpath" env:"SET_LOGGER_LOGPATH"` // 日志文件存放路径: 默认在 temp 目录 LogFile string `toml:"logfile" env:"SET_LOGGER_LOGFILE"` // 日志文件名字: 默认为 default.log MaxSize int `toml:"maxsize" env:"SET_LOGGER_MAXSIZE"` // 单个日志文件最大几M MaxBackups int `toml:"magbackups" env:"SET_LOGGER_MAXBACKUPS"` // 最大保存多少个 MaxAge int `toml:"maxage" env:"SET_LOGGER_MAXAGE"` // 最多保存几天 }
func DefaultLoggerConfig ¶
func DefaultLoggerConfig() *Logger
Click to show internal directories.
Click to hide internal directories.