Documentation ¶
Index ¶
- func Debug(args ...interface{})
- func Debugf(template string, args ...interface{})
- func Debugw(msg string, keysAndValues ...interface{})
- func Error(args ...interface{})
- func Errorf(template string, args ...interface{})
- func Errorw(msg string, keysAndValues ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(template string, args ...interface{})
- func Fatalw(msg string, keysAndValues ...interface{})
- func Info(args ...interface{})
- func Infof(template string, args ...interface{})
- func Infow(msg string, keysAndValues ...interface{})
- func InitLogger()
- func Panic(args ...interface{})
- func Panicf(template string, args ...interface{})
- func Panicw(msg string, keysAndValues ...interface{})
- func Warn(args ...interface{})
- func Warnf(template string, args ...interface{})
- func Warnw(msg string, keysAndValues ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debugf ¶
func Debugf(template string, args ...interface{})
带格式化的日志记录 logger.Infof("hello %s", "azu")
func Debugw ¶
func Debugw(msg string, keysAndValues ...interface{})
多参数(k v形式)日志记录 logger.Infow("aaaaaa",
zap.Int("status", 200), zap.String("method", "GET"),
)
func InitLogger ¶
func InitLogger()
*
- 初始化日志
- filename 日志文件路径
- level 日志级别
- maxSize 每个日志文件保存的最大尺寸 单位:M
- maxBackups 日志文件最多保存多少个备份
- maxAge 文件最多保存多少天
- compress 是否压缩
- serviceName 服务名
- 由于zap不具备日志切割功能, 这里使用lumberjack配合
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.