goProject/.svn/pristine/2d/2de12c2ba27e67d1efdfc163a25f3b7bd611f8a6.svn-base

58 lines
970 B
Plaintext
Raw Normal View History

2025-01-06 16:21:36 +08:00
package logUtil
import (
"goutil/logUtil/impl-localfile"
)
// 定义一个全局的日志对象
var (
// 日志列表
logs []ILog
// 文件log
fileLog *impl_localfile.Logger
)
func init() {
// 提供默认的日志对象
fileLog = impl_localfile.NewLogger()
logs = append(logs, fileLog)
}
// AddLogger
// @description: 添加日志对象
// parameter:
//
// @l:日志实现
//
// return:
func SettingLogs(_logs []ILog) {
if _logs == nil || len(_logs) == 0 {
panic("_logs不能为nil或者len(_logs)==0")
}
logs = _logs
}
// GetLocalFileLog
// @description: 获取文件日志对象
// parameter:
// return:
//
// @*log_localfile.Logger:
func GetLocalFileLog() *impl_localfile.Logger {
return fileLog
}
// SetLogPath
// @description: 设置文件日志路径
// parameter:
//
// @_logPath:路径
//
// return:
// Deprecated: use GetLocalFileLog().SetLogPath(_logPath) api instead
func SetLogPath(_logPath string) {
fileLog.SetLogPath(_logPath)
}