Documentation ¶
Index ¶
- func Debug(msg string, fields ...Field)
- func Debugf(format string, a ...interface{})
- func Error(msg string, fields ...Field)
- func Errorf(format string, a ...interface{})
- func Get() *zap.Logger
- func GetWithSkip(skip int) *zap.Logger
- func Info(msg string, fields ...Field)
- func Infof(format string, a ...interface{})
- func Init(opts ...Option) (*zap.Logger, error)
- func Panic(msg string, fields ...Field)
- func Warn(msg string, fields ...Field)
- func Warnf(format string, a ...interface{})
- func WithFields(fields ...Field) *zap.Logger
- type Field
- func Any(key string, val interface{}) Field
- func Bool(key string, val bool) Field
- func Duration(key string, val time.Duration) Field
- func Err(err error) Field
- func Float64(key string, val float64) Field
- func Int(key string, val int) Field
- func Int64(key string, val int64) Field
- func String(key string, val string) Field
- func Stringer(key string, val fmt.Stringer) Field
- func Time(key string, val time.Time) Field
- func Uint(key string, val uint) Field
- func Uint64(key string, val uint64) Field
- func Uintptr(key string, val uintptr) Field
- type FileOption
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetWithSkip ¶
GetWithSkip 获取defaultLogger,设置跳过的caller值,自定义显示代码行数
func Init ¶
Init 初始化打印设置 在终端打印debug级别日志示例:Init() 在终端打印info级别日志示例:Init(WithLevel("info")) 在终端打印json格式、debug级别日志示例:Init(WithFormat("json")) 把日志输出到文件out.log,使用默认的切割日志相关参数,debug级别日志示例:Init(WithSave()) 把日志输出到指定文件,自定义设置日志文件切割日志参数,json格式,debug级别日志示例: Init(
WithFormat("json"), WithSave(true, WithFileName("my.log"), WithFileMaxSize(5), WithFileMaxBackups(5), WithFileMaxAge(10), WithFileIsCompression(true), ))
Types ¶
type FileOption ¶
type FileOption func(*fileOptions)
FileOption set the file options.
func WithFileIsCompression ¶
func WithFileIsCompression(isCompression bool) FileOption
WithFileIsCompression 自定义是否压缩归档旧文件
func WithFileMaxBackups ¶
func WithFileMaxBackups(maxBackups int) FileOption
WithFileMaxBackups 自定义保留旧文件的最大个数
Click to show internal directories.
Click to hide internal directories.