0 Star 0 Fork 0

shallot / Go开发工具集

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
interface.go 627 Bytes
一键复制 编辑 原始数据 按行查看 历史
shallot 提交于 2024-01-07 19:09 . 合并网络库、日志库。
package logger
import (
"context"
"fmt"
"github.com/sirupsen/logrus"
)
// 记录正常信息
func Info(c context.Context, info string, fields ...interface{}) {
str := fmt.Sprintf(info, fields...)
logrus.WithContext(c).Info(str)
}
// 记录错误信息
func Error(c context.Context, err error, info string, fields ...interface{}) {
str := fmt.Sprintf(info, fields...)
logrus.WithContext(c).WithError(err).Error(str)
}
// 记录错误信息并推出
func Fatal(c context.Context, err error, info string, fields ...interface{}) {
str := fmt.Sprintf(info, fields...)
logrus.WithContext(c).WithError(err).Fatal(str)
}
Go
1
https://gitee.com/gxsshallot/gotool.git
git@gitee.com:gxsshallot/gotool.git
gxsshallot
gotool
Go开发工具集
337733503327

搜索帮助