Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Level string `json:"level" yaml:"level"` // 默认日志级别: debug, info, warn, error
ConsoleLevel string `json:"console_level" yaml:"consoleLevel"` // 控制台日志级别,默认继承 Level
Mode string `json:"mode" yaml:"mode"` // 运行模式: local, server
Format string `json:"format" yaml:"format"` // 控制台格式: console, json
Adaptors []string `json:"adaptors" yaml:"adaptors"` // 输出适配器 DSN 列表
Skip int `json:"skip" yaml:"skip"` // 跳过调用栈层数
JSON bool `json:"json" yaml:"json"` // 是否输出 JSON 格式
}
type FileOptions ¶ added in v0.2.0
type FileOptions struct {
Path string
Compress string
MaxSize int
MaxBackups int
MaxAge int
Level zapcore.Level
LevelSet bool
}
FileOptions 文件适配器选项
type HTTPOptions ¶ added in v0.2.0
type HTTPOptions struct {
URL string // HTTP URL
Timeout time.Duration // 超时时间
BufferSize int // 缓冲区大小
BatchSize int // 批量发送大小
MaxRetries int // 最大重试次数
Level zapcore.Level
LevelSet bool
}
HTTPOptions HTTP 适配器选项
type HTTPWriter ¶
type HTTPWriter struct {
// contains filtered or unexported fields
}
HTTPWriter 异步批量发送日志到 HTTP 端点
func (*HTTPWriter) Close ¶ added in v0.2.0
func (w *HTTPWriter) Close() error
Close 关闭 writer 并等待所有日志发送完成
type Logger ¶ added in v0.2.0
Logger 包装 zap.Logger,提供清理功能
func NewWithConfig ¶
NewWithConfig 根据配置创建日志实例
type MultiHandler ¶ added in v0.3.7
type MultiHandler struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.