Documentation
¶
Index ¶
- func AddFormatter(name string, f Formatter)
- func AddWriter(name string, w Writer)
- func Default() *zap.Logger
- func New(config Config) *zap.Logger
- func NewE(config Config) (*zap.Logger, error)
- func RemoveFormatter(names ...string)
- func RemoveWriter(names ...string)
- type Config
- type Encoder
- type Formatter
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFormatter ¶
AddFormatter Add custom log formatting processor
func RemoveFormatter ¶
func RemoveFormatter(names ...string)
RemoveFormatter Remove custom log formatting processor
func RemoveWriter ¶
func RemoveWriter(names ...string)
RemoveWriter Remove custom log writing driver
Types ¶
type Config ¶
type Config struct { Name string `json:"name"` // Name 日志名称 Output []string `json:"output"` // Output 输出渠道 Level string `json:"level"` // Level 日志记录级别 Trace bool `json:"trace"` // Trace 是否显示调用 Format string `json:"format"` // Format 日志格式化方式 Encoder Encoder `json:"encoder" mapstructure:"encoder"` // Encoder 日志显示格式化配置 LevelEncoder string `json:"levelEncoder"` // LevelEncoder 日志级别格式化处理 支持: capital, capitalColor, color, lower(default) TimeFormat string `json:"timeFormat"` // TimeFormat 时间格式化 Channels map[string]interface{} `json:"channels"` // Channels 日志输出渠道配置 }
Config Log configuration
type Encoder ¶
type Encoder struct { Name string `json:"name"` // Name 日志名称key Time string `json:"time"` // Time 日志时间key Level string `json:"level"` // Level 日志level key Caller string `json:"caller"` // Caller 日志调用位置key Message string `json:"message"` // Message 日志内容key Function string `json:"function"` // Function 日志调用函数key Stacktrace string `json:"stacktrace"` // Stacktrace 日志调用 trace key LineEnding string `json:"lineEnding"` // LineEnding 日志行尾结束符 }
Encoder Log content formatting configuration
type Formatter ¶
type Formatter func(cfg zapcore.EncoderConfig) zapcore.Encoder
Formatter Log formatting processor
type Writer ¶
type Writer func(option interface{}) (zapcore.WriteSyncer, error)
Writer Log Writer interface
Click to show internal directories.
Click to hide internal directories.