Documentation
¶
Index ¶
- Variables
- func C(ctx context.Context) *zapLogger
- func Debug(msg string, fields ...zapcore.Field)
- func Debugf(format string, v ...interface{})
- func Debugw(msg string, keysAndValues ...interface{})
- func Error(msg string, fields ...zapcore.Field)
- func Errorf(format string, v ...interface{})
- func Errorw(msg string, keysAndValues ...interface{})
- func Fatal(msg string, fields ...zapcore.Field)
- func Fatalf(format string, v ...interface{})
- func Fatalw(msg string, keysAndValues ...interface{})
- func Info(msg string, fields ...zapcore.Field)
- func Infof(format string, v ...interface{})
- func Infow(msg string, keysAndValues ...interface{})
- func Init(opts *Options)
- func NewChannel(c *Options) *zap.Logger
- func NewLogger(opts *Options) *zapLogger
- func Panic(msg string, fields ...zapcore.Field)
- func Panicf(format string, v ...interface{})
- func Panicw(msg string, keysAndValues ...interface{})
- func StdErrLogger() *log.Logger
- func StdInfoLogger() *log.Logger
- func SugaredLogger() *zap.SugaredLogger
- func Sync()
- func Warn(msg string, fields ...zapcore.Field)
- func Warnf(format string, v ...interface{})
- func Warnw(msg string, keysAndValues ...interface{})
- type Logger
- type Options
Constants ¶
This section is empty.
Variables ¶
View Source
var ( KeyTrace = "trace" KeySubject = "subject" KeyObject = "object" KeyInstance = "instance" KeyTask = "task" KeyCost = "cost" KeyResult = "result" KeyStatus = "status" KeyIP = "ip" KeyInfo = "info" KeyWatcher = "watcher" KeyCode = "code" KeyMessage = "message" )
View Source
var (
MaxBackups = 3
)
Functions ¶
func NewChannel ¶
func StdErrLogger ¶ added in v0.3.7
StdErrLogger returns logger of standard library which writes to supplied zap logger at error level.
func StdInfoLogger ¶ added in v0.3.7
StdInfoLogger returns logger of standard library which writes to supplied zap logger at info level.
func SugaredLogger ¶ added in v0.3.7
func SugaredLogger() *zap.SugaredLogger
SugaredLogger returns global sugared logger.
Types ¶
type Logger ¶
type Logger interface {
Debug(msg string, fields ...zapcore.Field)
Info(msg string, fields ...zapcore.Field)
Warn(msg string, fields ...zapcore.Field)
Error(msg string, fields ...zapcore.Field)
Panic(msg string, fields ...zapcore.Field)
Fatal(msg string, fields ...zapcore.Field)
Debugf(format string, v ...interface{})
Infof(format string, v ...interface{})
Warnf(format string, v ...interface{})
Errorf(format string, v ...interface{})
Panicf(format string, v ...interface{})
Fatalf(format string, v ...interface{})
Debugw(msg string, keysAndValues ...interface{})
Infow(msg string, keysAndValues ...interface{})
Warnw(msg string, keysAndValues ...interface{})
Errorw(msg string, keysAndValues ...interface{})
Panicw(msg string, keysAndValues ...interface{})
Fatalw(msg string, keysAndValues ...interface{})
Sync()
}
type Options ¶
type Options struct {
Level string `mapstructure:"level" json:"level" yaml:"level"`
Days int `mapstructure:"days" json:"days" yaml:"days"`
Console bool `mapstructure:"console" json:"console" yaml:"console"`
Format string `mapstructure:"format" json:"format" yaml:"format"`
MaxSize int `mapstructure:"maxSize" json:"maxSize" yaml:"maxSize"`
Compress bool `mapstructure:"compress" json:"compress" yaml:"compress"`
Path string `mapstructure:"path" json:"path" yaml:"path"`
}
func NewDefaultOptions ¶
func NewDefaultOptions() *Options
Click to show internal directories.
Click to hide internal directories.