New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
关于日志的输出信息 #1
Comments
|
func main() {
var log logker.Logger
format := "{level} - Date: {time} - 位置{position} - Message: {message}" //This version was modified from v 1.1.0
log = logker.NewClog(logker.INFO, logker.Shanghai, format)
log.Info("%v", log)
log.Warning("%v", logker.Shanghai)
} 自定义格式化formatting : //ormat := "{level} - {time} - {position} - {message}但是必须是👆的标签名字
|
package main
import (
"github.com/higker/logker"
"strings"
)
//type Formatting string
// logKer library Test
func main() {
//现在upgrade到v1.1.5版本即可自定义消息输出格式~
//format := "{level} - {time} - {position} - {message}"
var log logker.Logger
format := "{level} - 时间 {time} - 位置 {position} - 消息 {message}" //This version was modified from v 1.1.5
log = logker.NewClog(logker.DEBUG, logker.Shanghai, format)
log.Debug("DEBUG %s","自定义日志消息匹配符测试")
log.Info("%v", log)
log.Warning("%v", logker.Shanghai)
log.Error("ERROR")
} OutPut[ DEBUG ] - 时间 2020-04-20 11:57:23.8927 - 位置 main.go|main.main:23 - 消息 DEBUG 自定义日志消息匹配符测试
[ INFO ] - 时间 2020-04-20 11:57:23.8928 - 位置 main.go|main.main:24 - 消息 &{0 Asia/Shanghai 0xc00008e220 {level} - 时间 {t位置 {position} - 消息 {message}}
[WARNING] - 时间 2020-04-20 11:57:23.8928 - 位置 main.go|main.main:25 - 消息 Asia/Shanghai
[ ERROR ] - 时间 2020-04-20 11:57:23.8929 - 位置 main.go|main.main:26 - 消息 ERROR
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
现在的日志输出信息:
能不能提供一个选项,可以去掉
Date:
、Position:
以及Message:
这几个文本,因为很显而易见这栏就是时间,这栏就是代码位置,感觉没有必要,加上也增大了日志每行的长度最终的效果就是
另外这个 AM / PM 是否有必要存在呢,既然都已经是 24 小时制了?
The text was updated successfully, but these errors were encountered: