Documentation ¶
Index ¶
- func Debug(msg string, fields ...FieldInter)
- func DebugSkip(skip int, msg string, fields ...FieldInter)
- func Error(msg string, fields ...FieldInter)
- func ErrorSkip(skip int, msg string, fields ...FieldInter)
- func Fatal(msg string, fields ...FieldInter)
- func FatalSkip(skip int, msg string, fields ...FieldInter)
- func Fit(level string, logDir string, maxSize, maxAge int, utc bool, production bool)
- func Info(msg string, fields ...FieldInter)
- func InfoSkip(skip int, msg string, fields ...FieldInter)
- func Panic(msg string, fields ...FieldInter)
- func PanicSkip(skip int, msg string, fields ...FieldInter)
- func Set(level Level, logDir string, maxSize, maxAge int, utc bool, production bool)
- func Warn(msg string, fields ...FieldInter)
- func WarnSkip(skip int, msg string, fields ...FieldInter)
- type FieldInter
- type Level
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DebugSkip ¶
func DebugSkip(skip int, msg string, fields ...FieldInter)
DebugSkip 输出指定级别日志
skip 提升的堆栈帧数,0-当前函数,1-上一层函数。如果经封装调用该方法,默认2,否则默认1
msg 日志默认输出信息
fields 日志输出对象子集
func ErrorSkip ¶
func ErrorSkip(skip int, msg string, fields ...FieldInter)
ErrorSkip 输出指定级别日志
skip 提升的堆栈帧数,0-当前函数,1-上一层函数。如果经封装调用该方法,默认2,否则默认1
msg 日志默认输出信息
fields 日志输出对象子集
func FatalSkip ¶
func FatalSkip(skip int, msg string, fields ...FieldInter)
FatalSkip 输出指定级别日志
skip 提升的堆栈帧数,0-当前函数,1-上一层函数。如果经封装调用该方法,默认2,否则默认1
msg 日志默认输出信息
fields 日志输出对象子集
func Fit ¶
Fit log初始化
level 日志级别(debugLevel/infoLevel/warnLevel/ErrorLevel/panicLevel/fatalLevel)
logDir 日志文件目录
maxSize 每个日志文件保存的最大尺寸 单位:M
maxAge 文件最多保存多少天
utc CST & UTC 时间
production 是否生产环境,在生产环境下控制台不会输出任何日志
func InfoSkip ¶
func InfoSkip(skip int, msg string, fields ...FieldInter)
InfoSkip 输出指定级别日志
skip 提升的堆栈帧数,0-当前函数,1-上一层函数。如果经封装调用该方法,默认2,否则默认1
msg 日志默认输出信息
fields 日志输出对象子集
func PanicSkip ¶
func PanicSkip(skip int, msg string, fields ...FieldInter)
PanicSkip 输出指定级别日志
skip 提升的堆栈帧数,0-当前函数,1-上一层函数。如果经封装调用该方法,默认2,否则默认1
msg 日志默认输出信息
fields 日志输出对象子集
func Set ¶
Set log初始化
level 日志级别(debugLevel/infoLevel/warnLevel/ErrorLevel/panicLevel/fatalLevel)
logDir 日志文件目录
maxSize 每个日志文件保存的最大尺寸 单位:M
maxAge 文件最多保存多少天
utc CST & UTC 时间
production 是否生产环境,在生产环境下控制台不会输出任何日志
func WarnSkip ¶
func WarnSkip(skip int, msg string, fields ...FieldInter)
WarnSkip 输出指定级别日志
skip 提升的堆栈帧数,0-当前函数,1-上一层函数。如果经封装调用该方法,默认2,否则默认1
msg 日志默认输出信息
fields 日志输出对象子集
Types ¶
type FieldInter ¶
type FieldInter interface { GetKey() string GetValue() interface{} }
FieldInter field 接口
type Level ¶
type Level int8
A Level is a logging priority. Higher levels are more important.
func DebugLevel ¶
func DebugLevel() Level
DebugLevel logs are typically voluminous, and are usually disabled in production.
func ErrorLevel ¶
func ErrorLevel() Level
ErrorLevel logs are high-priority. If an application is running smoothly, it shouldn't generate any error-level logs.