Documentation ¶
Index ¶
- Constants
- Variables
- func Debug(msg string, fields ...zap.Field)
- func Error(msg string, fields ...zap.Field)
- func GetLevel() zapcore.Level
- func GetLevelStr() string
- func Info(msg string, fields ...zap.Field)
- func Level2String(level zapcore.Level) string
- func ParseLevel(level string) zapcore.Level
- func SetDefaultLogger(logger *Logger)
- func SetLogLevel(level zapcore.Level)
- func SetLogLevelStr(levelStr string)
- func Warn(msg string, fields ...zap.Field)
- type Logger
- func (z *Logger) Debug(msg string, fields ...zap.Field)
- func (z *Logger) Error(msg string, fields ...zap.Field)
- func (z *Logger) Info(msg string, fields ...zap.Field)
- func (z *Logger) Level() zapcore.Level
- func (z *Logger) LevelStr() string
- func (z *Logger) SetLevel(level zapcore.Level)
- func (z *Logger) SetLevelStr(sLevel string)
- func (z *Logger) Sync() error
- func (z *Logger) Warn(msg string, fields ...zap.Field)
- type ZapConf
Constants ¶
View Source
const ( //level string DebugLevelStr = "debug" InfoLevelStr = "info" WarnLevelStr = "warn" ErrorLevelStr = "error" //level define DebugLevel = zap.DebugLevel InfoLevel = zap.InfoLevel WarnLevel = zap.WarnLevel ErrorLevel = zap.ErrorLevel )
Variables ¶
View Source
var ( //ErrZapEmpty empty zap logger ErrZapEmpty = errors.New("zap.pointer.empty") )
Functions ¶
Types ¶
type Logger ¶
Logger 封装可以动态设置log level的logger
func NewSimpleLogger ¶
NewSimpleLogger new zap logger without file log
func (*Logger) SetLevelStr ¶
SetLevelStr set level string
type ZapConf ¶
type ZapConf struct { //文件名 FileName string `json:"fileName" toml:"fileName"` //文件最大长度 (M bytes) MaxSize int `json:"maxSize" toml:"maxSize"` //文件最久天数 MaxAge int `json:"maxAge" toml:"maxAge"` //最大备份文件数量 MaxBackups int `json:"maxBackups" toml:"maxBackups"` //是否在备份文件格式中使用utc time,否则为local time UTCTime bool `json:"utcTime" toml:"utcTime"` //是否压缩旧的文件 Compress bool `json:"compress" toml:"compress"` //Disable log caller DisableCaller bool `json:"disableCaller" toml:"disableCaller"` //log level LogLevel string `json:"logLevel" toml:"logLevel"` }
ZapConf zap configuration
Click to show internal directories.
Click to hide internal directories.