Documentation ¶
Index ¶
- Constants
- func InitLog(cfgFile, logDir string)
- type LogDriver
- type LogFitter
- func (t *LogFitter) Debug(msg string, ctx ...interface{})
- func (t *LogFitter) Error(msg string, ctx ...interface{})
- func (t *LogFitter) GetLogId() string
- func (t *LogFitter) Info(msg string, ctx ...interface{})
- func (t *LogFitter) SetCommField(key string, value interface{})
- func (t *LogFitter) SetInfoField(key string, value interface{})
- func (t *LogFitter) Trace(msg string, ctx ...interface{})
- func (t *LogFitter) Warn(msg string, ctx ...interface{})
- type Logger
- type Lvl
Constants ¶
View Source
const ( CommFieldLogId = "log_id" CommFieldSubMod = "s_mod" CommFieldPid = "pid" CommFieldCall = "call" )
Reserve common key
View Source
const (
DefaultCallDepth = 4
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LogDriver ¶
type LogDriver interface { Error(msg string, ctx ...interface{}) Warn(msg string, ctx ...interface{}) Info(msg string, ctx ...interface{}) Trace(msg string, ctx ...interface{}) Debug(msg string, ctx ...interface{}) }
底层日志库约束接口
type LogFitter ¶
type LogFitter struct {
// contains filtered or unexported fields
}
Logger Fitter 方便系统对日志输出做自定义扩展
func (*LogFitter) SetCommField ¶
func (*LogFitter) SetInfoField ¶
type Logger ¶
type Logger interface { GetLogId() string SetCommField(key string, value interface{}) SetInfoField(key string, value interface{}) Error(msg string, ctx ...interface{}) Warn(msg string, ctx ...interface{}) Info(msg string, ctx ...interface{}) Trace(msg string, ctx ...interface{}) Debug(msg string, ctx ...interface{}) }
在日志库之上做一层轻量级封装,方便日志字段组装和日志库替换 对外提供功能接口
type Lvl ¶
type Lvl int
Lvl is a type for predefined log levels.
List of predefined log Levels
func LvlFromString ¶
LvlFromString returns the appropriate Lvl from a string name. Useful for parsing command line args and configuration files.
Click to show internal directories.
Click to hide internal directories.