Documentation ¶
Index ¶
- Constants
- func Debug(logKey LogKeyEnum, params ...interface{})
- func Debugf(logKey LogKeyEnum, format string, params ...interface{})
- func Error(params ...interface{})
- func Errorf(format string, params ...interface{})
- func Fatal(params ...interface{})
- func Fatalf(format string, params ...interface{})
- func Flush()
- func GenLogConfigFile(cfgpath string)
- func Info(params ...interface{})
- func Infof(format string, params ...interface{})
- func Init(cfg string, srvname string, thgo *threads.ThreadGo)
- func LoggerSetConfig(v *LogFileConfig) option
- func Warn(params ...interface{})
- func Warnf(format string, params ...interface{})
- type LogFileConfig
- type LogKeyEnum
- type LoggerIO
- type LoggerMgr
Constants ¶
View Source
const ( LogLevelDefualt logLevel = -1 //未设置 LogLevelFatal logLevel = 0 //致命等级(输出致命日志)一般是未知错误,发生了里发报警 LogLevelError logLevel = 1 //错误等级(输出错误日志)一般是已知错误,发生了需要处理 LogLevelWarn logLevel = 2 //警告等级一般是配置表有错,但不影响正常运行等 LogLevelInfo logLevel = 3 //信息等级上线后正常需要看到的日志,报告状态等 LogLevelDebug logLevel = 4 //调试等级上线后不需要看到的日志,调试用,可以使用Key来临时开关的日志 )
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
func Debug(logKey LogKeyEnum, params ...interface{})
调试等级上线后不需要看到的日志,调试用,可以使用Key来临时开关的日志
func Debugf ¶
func Debugf(logKey LogKeyEnum, format string, params ...interface{})
调试等级上线后不需要看到的日志,调试用,可以使用Key来临时开关的日志
func LoggerSetConfig ¶
func LoggerSetConfig(v *LogFileConfig) option
Types ¶
type LogFileConfig ¶
type LogFileConfig struct { LogFileName string //日志文件名字 LogFilePath string //日志文件路径 LogFileLevel logLevel //日志文件等级 LogFileMaxLine int //单个日志文件最大行数 LogFileMaxNumber int //日志文件最大编号(如果为0则不会每个生成间隔内只会产生一个带日期后缀的日志文件,日志文件达到最大行数则不会再写日志) LogFileMaxSaveDays int //日志文件最大保存天数(<1:永久保存 >=1:第二天0点删除 ... 以此类推) Keys []string //Debug时可以输入的Key }
日志文件配置(如果没有传入新的日志文件配置则使用默认的NewLogFileConfig())
type LogKeyEnum ¶
type LogKeyEnum = string
日志枚举
const ( //缺省调试日志 LogKey_Default LogKeyEnum = "Default" //Entity有关的调试信息 LogKey_Entity LogKeyEnum = "Entity" //Mysql有关日志 LogKey_Mysql LogKeyEnum = "Mysql" //redis有关日志 LogKey_Redis LogKeyEnum = "Redis" //Gin内日志 LogKey_GinHttp LogKeyEnum = "Gin" //寻路系统日志 LogKey_PathFinder LogKeyEnum = "PathFinder" )
type LoggerIO ¶
type LoggerIO struct { LogLv logLevel Key LogKeyEnum }
一般第三方的框架都是可以设置一个支持io.Write接口的对象传入就可以了
Click to show internal directories.
Click to hide internal directories.