Documentation
¶
Index ¶
- func Debug(args ...interface{})
- func Debugf(template string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(template string, args ...interface{})
- func Info(args ...interface{})
- func Infof(template string, args ...interface{})
- func Init(cfg *Config) error
- func Warn(args ...interface{})
- func Warnf(template string, args ...interface{})
- func WithModule(module string) *zap.SugaredLogger
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debugf ¶
func Debugf(template string, args ...interface{})
Debugf logs a formatted message at debug level
func Errorf ¶
func Errorf(template string, args ...interface{})
Errorf logs a formatted message at error level
func Infof ¶
func Infof(template string, args ...interface{})
Infof logs a formatted message at info level
func Warnf ¶
func Warnf(template string, args ...interface{})
Warnf logs a formatted message at warn level
func WithModule ¶
func WithModule(module string) *zap.SugaredLogger
WithModule returns a logger with module field
Types ¶
type Config ¶
type Config struct {
Level string `mapstructure:"level"` // debug, info, warn, error
Filename string `mapstructure:"filename"` // 日志文件路径
MaxSize int `mapstructure:"max_size"` // 每个日志文件的最大大小(MB)
MaxBackups int `mapstructure:"max_backups"` // 保留的旧日志文件最大数量
MaxAge int `mapstructure:"max_age"` // 保留的旧日志文件的最大天数
Compress bool `mapstructure:"compress"` // 是否压缩旧日志文件
}
Config represents logger configuration
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns default logger configuration
Click to show internal directories.
Click to hide internal directories.