Documentation ¶
Index ¶
- Constants
- func CheckGMKey(logKey LogKeyEnum, all []interface{}) bool
- func CheckKey(logKey LogKeyEnum) bool
- 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 GmAddKey(key LogKeyEnum, OID []uint64)
- 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 MysqlWarn(params ...interface{})
- func ReLoadKeys(Keys []string)
- func ReLoadLevel(level logLevel)
- func ScreenDebug(logKey LogKeyEnum, params ...interface{})
- func Warn(params ...interface{})
- func Warnf(format string, params ...interface{})
- type GmKeyInfo
- type IScreen
- 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来临时开关的日志 )
View Source
const (
LOGFILE_INIT_NUMBER int = 0
)
Variables ¶
This section is empty.
Functions ¶
func CheckGMKey ¶
func CheckGMKey(logKey LogKeyEnum, all []interface{}) bool
func CheckKey ¶
func CheckKey(logKey LogKeyEnum) bool
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
func ScreenDebug ¶
func ScreenDebug(logKey LogKeyEnum, params ...interface{})
调试等级上线后不需要看到的日志,调试用,可以使用Key来临时开关的日志(这个会受GM 进行筛选)
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 AppendFileInfo bool //是否增加文件信息 TrimFilePath bool //是否去除文件的路径 }
日志文件配置(如果没有传入新的日志文件配置则使用默认的NewLogFileConfig())
func (*LogFileConfig) GetAtomicFileLevel ¶
func (cfg *LogFileConfig) GetAtomicFileLevel() logLevel
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" // 对C++内存的管理 LogKey_Lib LogKeyEnum = "Lib" //移动 LogKey_MoveSys LogKeyEnum = "MoveSys" //消息处理接口相关日志 LogKey_Msg LogKeyEnum = "Msg" // 注册 消息有关 LogKey_RegMsgProc LogKeyEnum = "RegMsgProc" // Kafka 日志 LogKey_LogKafka LogKeyEnum = "Kafka" )
type LoggerIO ¶
type LoggerIO struct { LogLv logLevel Key LogKeyEnum }
一般第三方的框架都是可以设置一个支持io.Write接口的对象传入就可以了
Click to show internal directories.
Click to hide internal directories.