tips

Tips

原文:https://github.com/sirupsen/logrus/wiki/Tips

pavel edited this page on Jul 7, 2021 · 2 revisions

pavel 在 2021 年 7 月 7 日编辑了此页面 · 2 次修订

​ 你可以设置默认的文本格式化器以显示完整的时间戳,像这样:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
package main

import (
	log "github.com/sirupsen/logrus"
)

func init() {
	log.SetFormatter(&log.TextFormatter{FullTimestamp: true})
}

func main() {
	log.Println("Fulltimestamp here")
}
最后修改 February 5, 2024: 更新 (f57b279)