Documentation
¶
Index ¶
- func CloseAll() error
- func Debug(args ...interface{})
- func Debugf(template string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(template string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(template string, args ...interface{})
- func Info(args ...interface{})
- func Infof(template string, args ...interface{})
- func InitDefaultLogger(config LogConfig) error
- func NewDefaultLogger(level, logFile, consoleFormat string) error
- func Sync() error
- func Warn(args ...interface{})
- func Warnf(template string, args ...interface{})
- type LogConfig
- type Logger
- func (l *Logger) Debug(args ...interface{})
- func (l *Logger) Debugf(template string, args ...interface{})
- func (l *Logger) Error(args ...interface{})
- func (l *Logger) Errorf(template string, args ...interface{})
- func (l *Logger) Fatal(args ...interface{})
- func (l *Logger) Fatalf(template string, args ...interface{})
- func (l *Logger) Info(args ...interface{})
- func (l *Logger) Infof(template string, args ...interface{})
- func (l *Logger) Sync() error
- func (l *Logger) Warn(args ...interface{})
- func (l *Logger) Warnf(template string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitDefaultLogger ¶
InitDefaultLogger 旧版本初始化函数,兼容老代码
func NewDefaultLogger ¶
NewDefaultLogger 旧版本初始化函数,兼容老代码
Types ¶
type LogConfig ¶
type LogConfig struct {
Level string // 日志级别: debug/info/warn/error/fatal
LogFile string // 日志文件路径,空串表示不输出到文件
ConsoleFormat string // 控制台格式: 空串或"off"表示关闭,支持"T(时间)L(级别)C(调用者)M(消息)"
MaxSize int // 单个日志文件文件最大大小
MaxBackups int // 最多保留几个日志文件备份
MaxAge int // 日志文件保留多少天
Compress bool // 日志备份文件是否压缩
}
LogConfig 日志配置结构体
func NewLogConfig ¶
NewLogConfig 创建日志配置实例,提供默认值
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger 日志器实例,线程安全
func CreateLogger ¶
CreateLogger 创建新的日志器
Click to show internal directories.
Click to hide internal directories.