Documentation ¶
Index ¶
- Constants
- func Configure() *options
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func Panic(args ...interface{})
- func Panicf(format string, args ...interface{})
- func ReplaceG(logger Logger)
- func Sync() error
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- type CallerEncoder
- type Level
- type LevelEncoder
- type Logger
- type OutputEncoder
- type ZapLoggerAdapter
Constants ¶
const ( DebugLevel = Level(zapcore.DebugLevel) InfoLevel = Level(zapcore.InfoLevel) WarnLevel = Level(zapcore.WarnLevel) ErrorLevel = Level(zapcore.ErrorLevel) FatalLevel = Level(zapcore.FatalLevel) PanicLevel = Level(zapcore.PanicLevel) )
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
func Debug(args ...interface{})
Debug logs a message at DebugLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the _global logger.
func Debugf ¶
func Debugf(format string, args ...interface{})
Debugf uses fmt.Sprintf to log a templated message.
func Error ¶
func Error(args ...interface{})
Error logs a message at ErrorLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the _global logger.
func Errorf ¶
func Errorf(format string, args ...interface{})
Errorf uses fmt.Sprintf to log a templated message.
func Fatal ¶
func Fatal(args ...interface{})
Fatal logs a message at FatalLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the _global logger.
func Fatalf ¶
func Fatalf(format string, args ...interface{})
Fatalf uses fmt.Sprintf to log a templated message.
func Info ¶
func Info(args ...interface{})
Info logs a message at InfoLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the _global logger.
func Infof ¶
func Infof(format string, args ...interface{})
Infof uses fmt.Sprintf to log a templated message.
func Panic ¶
func Panic(args ...interface{})
Panic logs a message at PanicLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the _global logger.
func Panicf ¶
func Panicf(format string, args ...interface{})
Panicf uses fmt.Sprintf to log a templated message.
func ReplaceG ¶
func ReplaceG(logger Logger)
ReplaceG replace the _global logger with the one passed by the parameter
func Sync ¶
func Sync() error
Sync flushing any buffered log entries. Applications should take care to call Sync before exiting.
Types ¶
type CallerEncoder ¶
type CallerEncoder zapcore.CallerEncoder
var ( FullCallerEncoder CallerEncoder = zapcore.FullCallerEncoder FullRoutineCallerEncoder CallerEncoder = func(caller zapcore.EntryCaller, enc zapcore.PrimitiveArrayEncoder) { enc.AppendString(fmt.Sprintf("%d#%d %s", os.Getegid(), oid.ID(), caller.String())) } ShortCallerEncoder CallerEncoder = zapcore.ShortCallerEncoder ShortRoutineCallerEncoder CallerEncoder = func(caller zapcore.EntryCaller, enc zapcore.PrimitiveArrayEncoder) { enc.AppendString(fmt.Sprintf("%d#%d %s", os.Getegid(), oid.ID(), caller.TrimmedPath())) } )
type LevelEncoder ¶
type LevelEncoder zapcore.LevelEncoder
var ( LowercaseLevelEncoder LevelEncoder = zapcore.LowercaseLevelEncoder LowercaseColorLevelEncoder LevelEncoder = zapcore.LowercaseColorLevelEncoder CapitalLevelEncoder LevelEncoder = zapcore.CapitalLevelEncoder CapitalColorLevelEncoder LevelEncoder = zapcore.CapitalColorLevelEncoder BracketLevelEncoder LevelEncoder = func(level zapcore.Level, encoder zapcore.PrimitiveArrayEncoder) { encoder.AppendString("[" + level.String() + "]") } )
type Logger ¶
type Logger interface { Debug(i ...interface{}) Debugf(format string, args ...interface{}) Info(i ...interface{}) Infof(format string, args ...interface{}) Warn(i ...interface{}) Warnf(format string, args ...interface{}) Error(i ...interface{}) Errorf(format string, args ...interface{}) Fatal(i ...interface{}) Fatalf(format string, args ...interface{}) Panic(i ...interface{}) Panicf(format string, args ...interface{}) With(fields ...interface{}) Logger Named(named string) Logger Sync() error StdLogger() *log.Logger }
func AssociateC ¶
AssociateC returns a copy of context.Context in which the Logger associated
type OutputEncoder ¶
type OutputEncoder func(cfg zapcore.EncoderConfig) zapcore.Encoder
var ( JsonOutputEncoder OutputEncoder = zapcore.NewJSONEncoder ConsoleOutputEncoder OutputEncoder = zapcore.NewConsoleEncoder )
type ZapLoggerAdapter ¶
type ZapLoggerAdapter struct {
*zap.SugaredLogger
}
ZapLoggerAdapter adapter for Logger
func (*ZapLoggerAdapter) Named ¶
func (z *ZapLoggerAdapter) Named(named string) Logger
func (*ZapLoggerAdapter) StdLogger ¶
func (z *ZapLoggerAdapter) StdLogger() *log.Logger
func (*ZapLoggerAdapter) With ¶
func (z *ZapLoggerAdapter) With(fields ...interface{}) Logger