Documentation ¶
Index ¶
- func GetLogger() *zap.Logger
- func InitLog(setting *configx.Log)
- func NewLogger(mod ...ModOptions) *zap.Logger
- 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) Init()
- func (l *Logger) Panic(args ...interface{})
- func (l *Logger) Panicf(template string, args ...interface{})
- func (l *Logger) Warn(args ...interface{})
- func (l *Logger) Warnf(template string, args ...interface{})
- func (l *Logger) With(args ...interface{}) *Logger
- func (l *Logger) WithConfig() zap.Option
- type ModOptions
- func SetAppName(AppName string) ModOptions
- func SetDebugFileName(DebugFileName string) ModOptions
- func SetDevelopment(Development bool) ModOptions
- func SetErrorFileName(ErrorFileName string) ModOptions
- func SetInfoFileName(InfoFileName string) ModOptions
- func SetLevel(Level zapcore.Level) ModOptions
- func SetLogFileDir(LogFileDir string) ModOptions
- func SetMaxAge(MaxAge int) ModOptions
- func SetMaxBackups(MaxBackups int) ModOptions
- func SetMaxSize(MaxSize int) ModOptions
- func SetWarnFileName(WarnFileName string) ModOptions
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLogger ¶
func NewLogger(mod ...ModOptions) *zap.Logger
Types ¶
type Logger ¶
type Logger struct { Logger *zap.Logger ZapSugar *zap.SugaredLogger ZapConfig zap.Config Opts *Options `json:"opts"` Initialized bool Mux sync.RWMutex }
func (*Logger) With ¶
With adds a variadic number of fields to the logging context. see https://github.com/uber-go/zap/blob/v1.10.0/sugar.go#L91
type ModOptions ¶
type ModOptions func(options *Options)
func SetAppName ¶
func SetAppName(AppName string) ModOptions
func SetDebugFileName ¶
func SetDebugFileName(DebugFileName string) ModOptions
func SetDevelopment ¶
func SetDevelopment(Development bool) ModOptions
func SetErrorFileName ¶
func SetErrorFileName(ErrorFileName string) ModOptions
func SetInfoFileName ¶
func SetInfoFileName(InfoFileName string) ModOptions
func SetLevel ¶
func SetLevel(Level zapcore.Level) ModOptions
func SetLogFileDir ¶
func SetLogFileDir(LogFileDir string) ModOptions
func SetMaxAge ¶
func SetMaxAge(MaxAge int) ModOptions
func SetMaxBackups ¶
func SetMaxBackups(MaxBackups int) ModOptions
func SetMaxSize ¶
func SetMaxSize(MaxSize int) ModOptions
func SetWarnFileName ¶
func SetWarnFileName(WarnFileName string) ModOptions
type Options ¶
type Options struct { Config zap.Config AppName string //日志文件前缀 Development bool //是否是开发模式 Level zapcore.Level //日志等级 LogFileDir string //文件保存地方 ErrorFileName string //error日志文件后缀 WarnFileName string //warn日志文件后缀 InfoFileName string //info日志文件后缀 DebugFileName string //debug日志文件后缀 MaxAge int //保存的最大天数 MaxBackups int //最多存在多少个切片文件 MaxSize int //日志文件小大(M) }
Click to show internal directories.
Click to hide internal directories.