logger

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

简单日志记录

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 Error

func Error(args ...interface{})

func Errorf

func Errorf(template string, args ...interface{})

func Errorw

func Errorw(msg string, keysAndValues ...interface{})

func Fatal

func Fatal(args ...interface{})

func Fatalf

func Fatalf(template string, args ...interface{})

func Fatalw

func Fatalw(msg string, keysAndValues ...interface{})

func Info

func Info(args ...interface{})

func Infof

func Infof(template string, args ...interface{})

func Infow

func Infow(msg string, keysAndValues ...interface{})

func InitLogger

func InitLogger()

*

  • 初始化日志
  • filename 日志文件路径
  • level 日志级别
  • maxSize 每个日志文件保存的最大尺寸 单位:M
  • maxBackups 日志文件最多保存多少个备份
  • maxAge 文件最多保存多少天
  • compress 是否压缩
  • serviceName 服务名
  • 由于zap不具备日志切割功能, 这里使用lumberjack配合

func Panic

func Panic(args ...interface{})

func Panicf

func Panicf(template string, args ...interface{})

func Panicw

func Panicw(msg string, keysAndValues ...interface{})

func Warn

func Warn(args ...interface{})

func Warnf

func Warnf(template string, args ...interface{})

func Warnw

func Warnw(msg string, keysAndValues ...interface{})

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL