Documentation ¶
Index ¶
- Constants
- func Debug(msg string)
- func Error(msg string)
- func Fatal(msg string)
- func Info(msg string)
- func SetDefaultLog(dfl Logger)
- func Warn(msg string)
- type Logger
- func Action(val string) Logger
- func Attach(l *zap.Logger) Logger
- func Data(val interface{}) Logger
- func GetDefaultLog() Logger
- func New(opt *Options) Logger
- func Request(val interface{}) Logger
- func Response(val interface{}) Logger
- func WithField(key string, val interface{}) Logger
- func WithFields(key string, val interface{}, kvs ...interface{}) Logger
- type Options
Constants ¶
View Source
const ( OutputStdout = "stdout" // default OutputStderr = "stderr" OutputFile = "file" FormatJSON = "json" // default FormatText = "text" LevelDebug = "debug" // default LevelInfo = "info" LevelWarn = "warn" LevelError = "error" LevelFatal = "fatal" LevelPanic = "panic" )
Variables ¶
This section is empty.
Functions ¶
func SetDefaultLog ¶
func SetDefaultLog(dfl Logger)
Types ¶
type Logger ¶
type Logger interface { AddCallerSkip(n int) Logger WithField(key string, val interface{}) Logger WithFields(key string, val interface{}, kvs ...interface{}) Logger Data(val interface{}) Logger Action(val string) Logger Request(val interface{}) Logger Response(val interface{}) Logger Debug(msg string) Info(msg string) Warn(msg string) Error(msg string) Fatal(msg string) }
func GetDefaultLog ¶
func GetDefaultLog() Logger
func WithFields ¶
type Options ¶
type Options struct { Output string `json:"output" yaml:"output"` Format string `json:"format" yaml:"format"` Level string `json:"level" yaml:"level"` TimeFormat string `json:"time_format" yaml:"time_format"` NoAddCaller bool `json:"no_caller" yaml:"no_caller"` // Output == OutputFile FileName string `json:"file_name" yaml:"file_name"` Size int `json:"size" yaml:"size"` }
Click to show internal directories.
Click to hide internal directories.