Documentation ¶
Index ¶
- Variables
- func TrunLevel(l string) zapcore.Level
- type Logger
- func (l *Logger) Debug(msg string)
- func (l *Logger) Debugf(format string, args ...interface{})
- func (l *Logger) Error(msg string)
- func (l *Logger) Errorf(format string, args ...interface{})
- func (l *Logger) Fatal(msg string)
- func (l *Logger) Fatalf(format string, args ...interface{})
- func (l *Logger) GetZap() *zap.Logger
- func (l *Logger) GetZapSugar() *zap.SugaredLogger
- func (l *Logger) Info(msg string)
- func (l *Logger) Infof(format string, args ...interface{})
- func (l *Logger) Named(name string) logger.Logger
- func (l *Logger) Panic(msg string)
- func (l *Logger) Panicf(format string, args ...interface{})
- func (l *Logger) Warn(msg string)
- func (l *Logger) Warnf(format string, args ...interface{})
- func (l *Logger) With(key string, value interface{}) logger.Logger
- type LoggerConf
- func (l *LoggerConf) AddStrTOFileName(addstr string) string
- func (l *LoggerConf) GetLevel() zapcore.Level
- func (l *LoggerConf) SetFormat(format string) *LoggerConf
- func (l *LoggerConf) SetLogFile(filename string) *LoggerConf
- func (l *LoggerConf) SetLogPath(path string) *LoggerConf
- func (l *LoggerConf) SetLogTo(station string) *LoggerConf
- type TO
Constants ¶
This section is empty.
Variables ¶
View Source
var LoggerLevel = zap.NewAtomicLevel()
LoggerLevel 动态设置 level 变量: 是全局参数,动态改变level后, 只影响改变时候处在的【作用域内的 logger】(不管是 父级 还是 兄弟 子孙 )
Functions ¶
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func (*Logger) GetZapSugar ¶
func (l *Logger) GetZapSugar() *zap.SugaredLogger
type LoggerConf ¶
type LoggerConf struct { Level string `toml:"level" env:"SET_LOGGER_Level"` Format string `toml:"format" env:"SET_LOGGER_FORMAT"` // 日志格式:plain, json; WriteTo TO `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() *LoggerConf
func (*LoggerConf) AddStrTOFileName ¶
func (l *LoggerConf) AddStrTOFileName(addstr string) string
AddStrTOFileName 文件由 a.log => a_addstr.log
func (*LoggerConf) SetFormat ¶
func (l *LoggerConf) SetFormat(format string) *LoggerConf
SetFormat 设置显示格式
func (*LoggerConf) SetLogFile ¶
func (l *LoggerConf) SetLogFile(filename string) *LoggerConf
SetLogFile 设置日志文件名称
func (*LoggerConf) SetLogPath ¶
func (l *LoggerConf) SetLogPath(path string) *LoggerConf
SetLogPath 设置日志路径
func (*LoggerConf) SetLogTo ¶
func (l *LoggerConf) SetLogTo(station string) *LoggerConf
SetLogTo 设置日志发送到哪里
Click to show internal directories.
Click to hide internal directories.