Documentation ¶
Index ¶
- Constants
- func Debug(a ...interface{})
- func Error(a ...interface{})
- func Finish()
- func Info(a ...interface{})
- func InitConfig(c Config)
- func Panic(a ...interface{})
- func SetLogFilePath(debugFile, infoFile, warnFile, errorFile, panicFile string, maxByte uint64)
- func SetLogRank(prevLength, consoleRank, fileRank uint)
- func SetPrevTime(format string)
- func Warn(a ...interface{})
- type Config
Constants ¶
View Source
const ( //日志打印登记常量 LogDebug = iota //调试 LogInfo //信息 LogWarn //警告 LogError //错误 LogPanic //恐慌 LogNotPrint //不打印 )
View Source
const NOPATH noPath = 1
Variables ¶
This section is empty.
Functions ¶
func InitConfig ¶
func InitConfig(c Config)
InitConfig 初始化日志打印配置,为了保证所有日志输出完毕,请在程序终止前,执行 rlog.Finish() 函数。 初始化的目的,是为了打印日志到文件,如果不打印到文件。则不需要执行本函数的初始化。
func SetLogFilePath ¶
SetLogFilePath 设置日志文件地址,不设置地址,不打印到文件。
func SetLogRank ¶
func SetLogRank(prevLength, consoleRank, fileRank uint)
SetLogRank 设置日志打印等级 prevLength:项目地址前面省去多少字符
Types ¶
type Config ¶
type Config struct { //PrevLength 可以通过以下代码,计算出你的项目地址,前缀长度。 // getwd, _ := os.Getwd() // fmt.Println(len(getwd) + 1) //但,需要注意的是, PrevLength 必须是固定值,而不能使用动态计算前缀长度的方式。 PrevLength uint `json:"prev_length"` //日志打印地址前面省略多少个字符,0则打印完整地址。默认0。 ConsoloRank uint `json:"consolo_rank"` //控制台日志打印等级 FileRank uint `json:"file_rank"` //文件日志打印等级 MaxFileSize uint64 `json:"max_file_size"` //日志文件最大大小,1024 * 1024 * 1 为 1MB,如果该值为0,那么执行默认 1MB 。 DebugFile string `json:"debug_file"` //Debug日志文件路径 InfoFile string `json:"info_file"` //Info日志文件路径 WarnFile string `json:"warn_file"` //Warn日志文件路径 ErrorFile string `json:"error_file"` //Error日志文件路径 PanicFile string `json:"panic_file"` //Panic日志文件路径 }
Click to show internal directories.
Click to hide internal directories.