Documentation ¶
Index ¶
- func C(ctx context.Context) *zapLogger
- func Debugw(msg string, keysAndValues ...interface{})
- func Errorw(msg string, keysAndValues ...interface{})
- func Fatalw(msg string, keysAndValues ...interface{})
- func Infow(msg string, keysAndValues ...interface{})
- func Init(opts *Options)
- func NewLogger(opts *Options) *zapLogger
- func Panicw(msg string, keysAndValues ...interface{})
- func Sync()
- func Warnw(msg string, keysAndValues ...interface{})
- type Logger
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Logger ¶
type Logger 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() }
Logger 定义了 miniblog 项目的日志接口. 该接口只包含了支持的日志记录方法.
type Options ¶
type Options struct { // 是否开启 caller,如果开启会在日志中显示调用日志所在的文件和行号 DisableCaller bool // 是否禁止在 panic 及以上级别打印堆栈信息 DisableStacktrace bool // 指定日志级别,可选值:debug, info, warn, error, dpanic, panic, fatal Level string // 指定日志显示格式,可选值:console, json Format string // 指定日志输出位置 OutputPaths []string }
Options 包含与日志相关的配置项.
func NewOptions ¶
func NewOptions() *Options
Click to show internal directories.
Click to hide internal directories.