Documentation ¶
Index ¶
- Variables
- func CloseLogger()
- func DPanic(args ...interface{})
- func DPanicf(template string, args ...interface{})
- func DPanicln(args ...interface{})
- func DPanicw(msg string, keysAndValues ...interface{})
- func DPanicx(msg string, fields ...zapcore.Field)
- func Debug(args ...interface{})
- func Debugf(template string, args ...interface{})
- func Debugln(args ...interface{})
- func Debugw(msg string, keysAndValues ...interface{})
- func Debugx(msg string, fields ...zapcore.Field)
- func Error(args ...interface{})
- func Errorf(template string, args ...interface{})
- func Errorln(args ...interface{})
- func Errorw(msg string, keysAndValues ...interface{})
- func Errorx(msg string, fields ...zapcore.Field)
- func Fatal(args ...interface{})
- func Fatalf(template string, args ...interface{})
- func Fatalln(args ...interface{})
- func Fatalw(msg string, keysAndValues ...interface{})
- func Fatalx(msg string, fields ...zapcore.Field)
- func Info(args ...interface{})
- func Infof(template string, args ...interface{})
- func Infoln(args ...interface{})
- func Infow(msg string, keysAndValues ...interface{})
- func Infox(msg string, fields ...zapcore.Field)
- func Panic(args ...interface{})
- func Panicf(template string, args ...interface{})
- func Panicln(args ...interface{})
- func Panicw(msg string, keysAndValues ...interface{})
- func Panicx(msg string, fields ...zapcore.Field)
- func SetLevel(l zapcore.Level)
- func SetupConsoleLogger(logfile string, options ...zap.Option)
- func SetupJSONLogger(logfile string, options ...zap.Option)
- func SetupLogger(logfile string, encoder zapcore.Encoder, options ...zap.Option)
- func Warn(args ...interface{})
- func Warnf(template string, args ...interface{})
- func Warning(args ...interface{})
- func Warningf(template string, args ...interface{})
- func Warningln(args ...interface{})
- func Warningw(msg string, keysAndValues ...interface{})
- func Warningx(msg string, fields ...zapcore.Field)
- func Warnln(args ...interface{})
- func Warnw(msg string, keysAndValues ...interface{})
- func Warnx(msg string, fields ...zapcore.Field)
- type Logger
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultConfig 日志配置 DefaultConfig = zapcore.EncoderConfig{ CallerKey: "line", LevelKey: "level", MessageKey: "message", TimeKey: "time", StacktraceKey: "stacktrace", LineEnding: zapcore.DefaultLineEnding, EncodeTime: zapcore.ISO8601TimeEncoder, EncodeLevel: func(level zapcore.Level, encoder zapcore.PrimitiveArrayEncoder) { encoder.AppendString(firstUpper(level.String())) }, EncodeCaller: func(caller zapcore.EntryCaller, encoder zapcore.PrimitiveArrayEncoder) { encoder.AppendString("[" + caller.TrimmedPath() + "]") }, EncodeDuration: zapcore.SecondsDurationEncoder, EncodeName: zapcore.FullNameEncoder, ConsoleSeparator: " ", } )
Functions ¶
func DPanicf ¶
func DPanicf(template string, args ...interface{})
DPanicf 输出格式化的"DPanic"级别日志信息,但不引发程序Panic
func DPanicw ¶
func DPanicw(msg string, keysAndValues ...interface{})
DPanicw 输出定制化的"Panic"级别日志信息,但不引发程序Panic()
func Fatalf ¶
func Fatalf(template string, args ...interface{})
Fatalf 输出格式化的"Fatal"级别日志信息,并使程序退出(os.Exit(1);
func Fatalw ¶
func Fatalw(msg string, keysAndValues ...interface{})
Fatalw 输出定制化的"Fatal"级别日志信息,并使程序退出(os.Exit(1);
func Panicf ¶
func Panicf(template string, args ...interface{})
Panicf 输出格式化的"Panic"级别日志信息,并引发程序Panic;
func Panicw ¶
func Panicw(msg string, keysAndValues ...interface{})
Panicw 输出定制化的"Panic"级别日志信息,并引发程序Panic;
func SetupConsoleLogger ¶ added in v1.0.2
SetupConsoleLogger 配置日志记录器
func SetupJSONLogger ¶ added in v1.0.2
SetupJSONLogger 配置日志记录器
func Warningw ¶
func Warningw(msg string, keysAndValues ...interface{})
Warningw 输出定制化的"Warn"级别日志信息;
Types ¶
type Logger ¶
type Logger interface { Print(...interface{}) Println(...interface{}) Printf(string, ...interface{}) Printw(string, ...interface{}) Printx(string, ...zapcore.Field) Debug(...interface{}) Debugln(...interface{}) Debugf(string, ...interface{}) Debugw(string, ...interface{}) Debugx(string, ...zapcore.Field) Info(...interface{}) Infoln(...interface{}) Infof(string, ...interface{}) Infow(string, ...interface{}) Infox(string, ...zapcore.Field) Warn(...interface{}) Warnln(...interface{}) Warnf(string, ...interface{}) Warnw(string, ...interface{}) Warnx(string, ...zapcore.Field) Warning(...interface{}) Warningln(...interface{}) Warningf(string, ...interface{}) Warningw(string, ...interface{}) Warningx(string, ...zapcore.Field) Error(...interface{}) Errorln(...interface{}) Errorf(string, ...interface{}) Errorw(string, ...interface{}) Errorx(string, ...zapcore.Field) Panic(...interface{}) Panicln(...interface{}) Panicf(string, ...interface{}) Panicw(string, ...interface{}) Panicx(string, ...zapcore.Field) Fatal(...interface{}) Fatalln(...interface{}) Fatalf(string, ...interface{}) Fatalw(string, ...interface{}) Fatalx(string, ...zapcore.Field) DPanic(...interface{}) DPanicln(...interface{}) DPanicf(string, ...interface{}) DPanicw(string, ...interface{}) DPanicx(string, ...zapcore.Field) GetSubLogger() Logger GetSubLoggerWithKeyValue(map[string]string) Logger GetSubLoggerWithOption(...zap.Option) Logger }
func GetSubLoggerWithKeyValue ¶
GetSubLoggerWithKeyValue 使用指定的key/value,获取一个带有输出key/value内容的子logger
func GetSubLoggerWithOption ¶
Click to show internal directories.
Click to hide internal directories.