4 Star 5 Fork 4

Plato/Service-Box-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
tools.go 826 Bytes
一键复制 编辑 原始数据 按行查看 历史
package zap
import (
"fmt"
"go.uber.org/zap/zapcore"
)
func LogNameEncoder(loggerName string, enc zapcore.PrimitiveArrayEncoder) {
enc.AppendString(loggerName)
}
func CapitalLevelEncoder(l zapcore.Level, enc zapcore.PrimitiveArrayEncoder) {
level := ""
switch l {
case zapcore.DebugLevel:
level = "[debug]"
case zapcore.InfoLevel:
level = "[info]"
case zapcore.WarnLevel:
level = "[warn]"
case zapcore.ErrorLevel:
level = "[error]"
case zapcore.DPanicLevel:
level = "[dpanic]"
case zapcore.PanicLevel:
level = "[panic]"
case zapcore.FatalLevel:
level = "[fatal]"
default:
level = fmt.Sprintf("[level(%d)]", l)
}
enc.AppendString(level)
}
func ShortEncodeCaller(caller zapcore.EntryCaller, enc zapcore.PrimitiveArrayEncoder) {
enc.AppendString(fmt.Sprintf("[%s]", caller.TrimmedPath()))
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/dennis-kk/service-box-go.git
git@gitee.com:dennis-kk/service-box-go.git
dennis-kk
service-box-go
Service-Box-go
v0.4.33

搜索帮助