Documentation
¶
Index ¶
- Constants
- func Configure(cfg Map)
- func Console(args ...Any)
- func Debug(args ...Any)
- func Fatal(args ...Any)
- func Go()
- func Info(args ...Any)
- func Levels() map[Level]string
- func Notice(args ...Any)
- func Panic(args ...Any)
- func Ready()
- func Register(name string, value Any, overrides ...bool)
- func Trace(args ...Any)
- func Warning(args ...Any)
- type Config
- type Connect
- type Driver
- type Level
- type Log
- type Module
- func (this *Module) Config(name string, config Config, override bool)
- func (this *Module) Configure(global Map)
- func (this *Module) Connect()
- func (this *Module) Console(args ...Any)
- func (this *Module) Debug(args ...Any)
- func (this *Module) Driver(name string, driver Driver, override bool)
- func (this *Module) Fatal(args ...Any)
- func (this *Module) Flush()
- func (this *Module) Info(args ...Any)
- func (this *Module) Initialize()
- func (this *Module) Launch()
- func (this *Module) Logging(level Level, body string) error
- func (this *Module) Notice(args ...Any)
- func (this *Module) Panic(args ...Any)
- func (this *Module) Register(name string, value Any, override bool)
- func (this *Module) Terminate()
- func (this *Module) Trace(args ...Any)
- func (this *Module) Warning(args ...Any)
- func (this *Module) Write(msg *Log) error
Constants ¶
View Source
const (
NAME = "LOG"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// Driver 日志驱动,默认为 default
Driver string
// Level 输出的日志级别
// fatal, panic, warning, notice, info, trace, debug
Level Level
// Json 是否开启json输出模式
// 开启后,所有日志 body 都会被包装成json格式输出
Json bool
// Sync 是否开启同步输出,默认为false,表示异步输出
// 注意:如果开启同步输出,有可能影响程序性能
Sync bool
// Pool 异步缓冲池大小
Pool int
// Format 日志输出格式,默认格式为 %time% [%level%] %body%
// 可选参数,参数使用 %% 包裹,如 %time%
// time 格式化后的时间,如:2006-01-02 15:03:04.000
// unix unix时间戳,如:1650271473
// level 日志级别,如:TRACE
// body 日志内容
Format string `toml:"format"`
// Setting 是为不同驱动准备的自定义参数
// 具体参数表,请参考各不同的驱动
Setting Map `toml:"setting"`
}
LogConfig 日志模块配置
type Connect ¶
type Connect interface {
// Open 打开连接
Open() error
// Close 关闭结束
Close() error
// Write 写入日志
Write(*Log) error
// Flush 冲马桶
Flush()
}
LogConnect 日志连接
type Log ¶
Click to show internal directories.
Click to hide internal directories.