13 Star 74 Fork 13

kelvins-io / g2cache

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
log.go 1.53 KB
一键复制 编辑 原始数据 按行查看 历史
雨化田 提交于 2021-04-22 18:20 . fix log,默认参数
package g2cache
import (
"log"
)
// 外部调用者可实现此日志接口用于将日志导出
type LoggerInterface interface {
LogInfoF(f string, s ...interface{})
LogInfo(s ...interface{})
LogDebug(s ...interface{})
LogDebugF(f string, s ...interface{})
LogErr(s ...interface{})
LogErrF(f string, s ...interface{})
}
func LogInfoF(f string, s ...interface{}) {
Logger.LogInfoF(f, s)
}
func LogInfo(s ...interface{}) {
Logger.LogInfo(s)
}
func LogDebug(s ...interface{}) {
Logger.LogDebug(s)
}
func LogDebugF(f string, s ...interface{}) {
Logger.LogDebugF(f, s)
}
func LogErr(s ...interface{}) {
Logger.LogErr(s)
}
func LogErrF(f string, s ...interface{}) {
Logger.LogErrF(f, s)
}
type sysLogger struct{}
var (
Logger LoggerInterface = &sysLogger{}
)
func (l *sysLogger) LogInfo(s ...interface{}) {
log.Println("[\u001B[32mg2cache\u001B[0m] [\u001B[32minfo\u001B[0m] ", s)
}
func (l *sysLogger) LogInfoF(f string, s ...interface{}) {
log.Printf("[\u001B[32mg2cache\u001B[0m] [\u001B[32minfo\u001B[0m] "+f, s)
}
func (l *sysLogger) LogDebug(s ...interface{}) {
log.Println("[\u001B[32mg2cache\u001B[0m] [\u001B[33mdebug\u001B[0m] ", s)
}
func (l *sysLogger) LogDebugF(f string, s ...interface{}) {
log.Printf("[\u001B[32mg2cache\u001B[0m] [\u001B[33mdebug\u001B[0m] "+f, s)
}
func (l *sysLogger) LogErr(s ...interface{}) {
log.Println("[\u001B[32mg2cache\u001B[0m] [\u001B[31merr\u001B[0m] ", s)
}
func (l *sysLogger) LogErrF(f string, s ...interface{}) {
log.Printf("[\u001B[32mg2cache\u001B[0m] [\u001B[31merr\u001B[0m] "+f, s)
}
Go
1
https://gitee.com/kelvins-io/g2cache.git
git@gitee.com:kelvins-io/g2cache.git
kelvins-io
g2cache
g2cache
release

搜索帮助