Documentation ¶
Index ¶
- func Debug(ctx context.Context, msg string, fields ...zap.Field)
- func Error(ctx context.Context, msg string, fields ...zap.Field)
- func Fatal(ctx context.Context, msg string, fields ...zap.Field)
- func GetLevel() zapcore.Level
- func Info(ctx context.Context, msg string, fields ...zap.Field)
- func Init(conf *Config)
- func L() *zap.Logger
- func Panic(ctx context.Context, msg string, fields ...zap.Field)
- func ReplaceGlobals(logger *zap.Logger, props *Properties) func()
- func SetLevel(l zapcore.Level)
- func Sync() error
- func Warn(ctx context.Context, msg string, fields ...zap.Field)
- func With(fields ...zap.Field) *zap.Logger
- func WriterHook(filename string, config *FileConf) lumberjack.Logger
- type Config
- type FileConf
- type GormOption
- type Properties
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Error ¶
Error logs a message at ErrorLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
func Fatal ¶
Fatal logs a message at FatalLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
The logger then calls os.Exit(1), even if logging at FatalLevel is disabled.
func Panic ¶
Panic logs a message at PanicLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
The logger then panics, even if logging at PanicLevel is disabled.
func ReplaceGlobals ¶
func ReplaceGlobals(logger *zap.Logger, props *Properties) func()
func Warn ¶
Warn logs a message at WarnLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
func With ¶
With creates a child logger and adds structured context to it. Fields added to the child don't affect the parent, and vice versa.
func WriterHook ¶
Types ¶
type FileConf ¶
type FileConf struct { MaxSize int // 每个日志文件保存的大小 单位:M MaxAge int // 文件最多保存多少天 MaxBackups int // 日志文件最多保存多少个备份 Compress bool // 是否压缩 }
Silent LogLevel = iota + 1 Error Warn Info
type GormOption ¶
type Properties ¶
type Properties struct { Core zapcore.Core WritesAll zapcore.WriteSyncer WritesErr zapcore.WriteSyncer Level zap.AtomicLevel }