mirror of
https://gitee.com/shikong-sk/golang-study
synced 2025-02-23 15:32:15 +08:00
docs: 手动实现 simple log 日志库
This commit is contained in:
parent
cd1c2fe26d
commit
42e5a2873d
@ -14,7 +14,7 @@ func TestLog(t *testing.T) {
|
|||||||
WithWriter(os.Stdout),
|
WithWriter(os.Stdout),
|
||||||
WithTimeFormat("2006-01-02"),
|
WithTimeFormat("2006-01-02"),
|
||||||
WithLogFormat("%-10s %s %v %s =-=-> %s\n"),
|
WithLogFormat("%-10s %s %v %s =-=-> %s\n"),
|
||||||
WithLogFlag(FlagInfo|FlagDebug),
|
WithLogFlag(FlagInfo|FlagWarn|FlagError),
|
||||||
)
|
)
|
||||||
|
|
||||||
fmt.Printf("simpleLog => %#v\n", log)
|
fmt.Printf("simpleLog => %#v\n", log)
|
||||||
@ -30,6 +30,7 @@ func TestLog(t *testing.T) {
|
|||||||
|
|
||||||
for i := 0; i < 5; i++ {
|
for i := 0; i < 5; i++ {
|
||||||
log2.Debug("测试 Debug 输出")
|
log2.Debug("测试 Debug 输出")
|
||||||
|
log2.Info("测试 Info 输出")
|
||||||
time.Sleep(100 * time.Millisecond)
|
time.Sleep(100 * time.Millisecond)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user