8 Star 47 Fork 21

Lucky / go-hutool

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
formatter_interface.go 486 Bytes
一键复制 编辑 原始数据 按行查看 历史
huangxutao 提交于 2019-11-13 17:55 . :sparkles:添加新特性。日志打印处理
package logging
import (
"fmt"
"path/filepath"
"runtime"
)
const (
// Runtime caller depth
depth = 3
)
// Formatter interface
type Formatter interface {
GetPrefix(lvl level) string
Format(lvl level, v ...interface{}) []interface{}
GetSuffix(lvl level) string
}
// Returns header including filename and line number
func header() string {
_, fn, line, ok := runtime.Caller(depth)
if !ok {
fn = "???"
line = 1
}
return fmt.Sprintf("%s:%d ", filepath.Base(fn), line)
}
Go
1
https://gitee.com/huangbosbos/go-hutool.git
git@gitee.com:huangbosbos/go-hutool.git
huangbosbos
go-hutool
go-hutool
81f09a275c3b

搜索帮助