Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Level LogLevel `json:"level" yaml:"level"`
Format string `json:"format" yaml:"format"` // json, text
Output string `json:"output" yaml:"output"` // stdout, stderr, file
FilePath string `json:"file_path" yaml:"file_path"`
MaxSize int `json:"max_size" yaml:"max_size"` // MB
MaxBackups int `json:"max_backups" yaml:"max_backups"` // 保留的备份文件数量
MaxAge int `json:"max_age" yaml:"max_age"` // 保留天数
Compress bool `json:"compress" yaml:"compress"` // 是否压缩
}
Config 日志配置
type Logger ¶
type Logger interface {
Debug(args ...interface{})
Info(args ...interface{})
Warn(args ...interface{})
Error(args ...interface{})
Fatal(args ...interface{})
Debugf(format string, args ...interface{})
Infof(format string, args ...interface{})
Warnf(format string, args ...interface{})
Errorf(format string, args ...interface{})
Fatalf(format string, args ...interface{})
WithField(key string, value interface{}) Logger
WithFields(fields map[string]interface{}) Logger
WithError(err error) Logger
WithContext(ctx context.Context) Logger
}
Logger 日志接口
var DefaultLogger Logger
DefaultLogger 默认日志器
Click to show internal directories.
Click to hide internal directories.