Documentation ¶
Index ¶
- Variables
- func C(ctx context.Context) *zapLogger
- func Debug(msg string, fields ...Field)
- func Debugf(format string, v ...interface{})
- func Debugw(msg string, keysAndValues ...interface{})
- func Error(msg string, fields ...Field)
- func Errorf(format string, v ...interface{})
- func Errorw(msg string, keysAndValues ...interface{})
- func Fatal(msg string, fields ...Field)
- func Fatalf(format string, v ...interface{})
- func Fatalw(msg string, keysAndValues ...interface{})
- func Flush()
- func Info(msg string, fields ...Field)
- func Infof(format string, v ...interface{})
- func Infow(msg string, keysAndValues ...interface{})
- func Init(opts *Options)
- func New(opts *Options) *zapLogger
- func Panic(msg string, fields ...Field)
- func Panicf(format string, v ...interface{})
- func Panicw(msg string, keysAndValues ...interface{})
- func Warn(msg string, fields ...Field)
- func Warnf(format string, v ...interface{})
- func Warnw(msg string, keysAndValues ...interface{})
- func WithContext(ctx context.Context) context.Context
- type Field
- type Level
- type Logger
- type Options
Constants ¶
This section is empty.
Variables ¶
View Source
var Any = zap.Any
alias for zap function
Functions ¶
func Debugw ¶
func Debugw(msg string, keysAndValues ...interface{})
Debugw method output debug level log.
func Errorw ¶
func Errorw(msg string, keysAndValues ...interface{})
Errorw method output error level log.
func Fatalw ¶
func Fatalw(msg string, keysAndValues ...interface{})
Fatalw method output Fatalw level log.
func Infow ¶
func Infow(msg string, keysAndValues ...interface{})
Infow method output info level log.
func Panicf ¶
func Panicf(format string, v ...interface{})
Panicf method output panic level log and shutdown application.
func Panicw ¶
func Panicw(msg string, keysAndValues ...interface{})
Panicw method output panic level log.
Types ¶
type Logger ¶
type Logger interface { Debug(msg string, fields ...Field) Debugf(format string, v ...interface{}) Debugw(msg string, keysAndValues ...interface{}) Info(msg string, fields ...Field) Infof(format string, v ...interface{}) Infow(msg string, keysAndValues ...interface{}) Warn(msg string, fields ...Field) Warnf(format string, v ...interface{}) Warnw(msg string, keysAndValues ...interface{}) Error(msg string, fields ...Field) Errorf(format string, v ...interface{}) Errorw(msg string, keysAndValues ...interface{}) Panic(msg string, fields ...Field) Panicf(format string, v ...interface{}) Panicw(msg string, keysAndValues ...interface{}) Fatal(msg string, fields ...Field) Fatalf(format string, v ...interface{}) Fatalw(msg string, keysAndValues ...interface{}) // add some key-value pairs of context to a logger WithValues(keysAndValue ...interface{}) Logger WithName(string) Logger // WithContext returns a copy of context in which the log value is set. WithContext(ctx context.Context) context.Context // flush any buffered log entries. Applications should take care to call Sync before exiting Flush() }
func FromContext ¶
FromContext returns the value of the log key on the ctx
func WithValues ¶
func WithValues(keysAndValues ...interface{}) Logger
WithValues creates a child logger and adds zap fileds to it
type Options ¶
type Options struct { OutputPaths []string `json:"output-paths" mapstructure:"output-paths"` ErrorOutputPaths []string `json:"error-output-paths" mapstructure:"error-output-paths"` Level string `json:"level" mapstructure:"level"` // log-level Format string `json:"format" mapstructure:"format"` // log file output format, JSON or Console(txt) DisableCaller bool `json:"disable-caller" mapstructure:"disable-caller"` // show name,location and line No. of the funcation called DisableStacktrace bool `json:"disable-stacktrace" mapstructure:"disable-stacktrace"` EnableColor bool `json:"enable-color" mapstructure:"enable-color"` Development bool `json:"development" mapstructure:"development"` Name string `json:"name" mapstructure:"name"` // logger name CommonFields []string `json:"common-fields" mapstructure:"common-fields"` // common log fields, eg: requestId, username }
Options
Click to show internal directories.
Click to hide internal directories.