Documentation ¶
Overview ¶
日志调度器 功能: 初始化各个日志处理器
使用: logger := logs.NewDispatcher() logger.SetTarget(logs.TARGET_FILE, `{"filename":"xxxx.log","level":10,"max_size":500,"rotate":true}`) logger.Error("这是一个错误") logger.Debug("这是一个调试") logger.Info("这是一个信息") logger.Warn("这是一个警告")
Index ¶
- Constants
- func Black(str string) string
- func Blue(str string) string
- func Cyan(str string) string
- func Green(str string) string
- func Magenta(str string) string
- func Red(str string) string
- func RegisterTareget(name string, tg target)
- func White(str string) string
- func Yellow(str string) string
- type Dispatcher
- type LogCategory
Constants ¶
View Source
const ( TextBlack = iota + 30 TextRed TextGreen TextYellow TextBlue TextMagenta TextCyan TextWhite )
View Source
const ( LOG_ERROR = iota LOG_WARN LOG_INFO LOG_TRACE LOG_DEBUG )
日志等级
View Source
const ( TARGET_FILE = "file" TARGET_CONSOLE = "console" )
日志落地标志
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Dispatcher ¶
type Dispatcher struct { Level int Targets []*logTarget }
调度器对象
func (*Dispatcher) SetTarget ¶
func (d *Dispatcher) SetTarget(name string, config string)
设置日志处理对象(TAGET_FILE TAGET_CONSOLE)
type LogCategory ¶
type LogCategory string
Click to show internal directories.
Click to hide internal directories.