Skip to content

Commit 7d31147

Browse files
author
mobus
committed
add level type function
1 parent 6e710c7 commit 7d31147

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

examples/log/log_ex.go

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,30 @@
11
package main
22

3-
import "github.com/sunvim/utils/log"
3+
import (
4+
"fmt"
5+
6+
"github.com/sunvim/utils/log"
7+
)
48

59
func main() {
6-
log.SetPrefix("Hello")
10+
log.SetPrefix("Example")
11+
12+
fmt.Println("debug level")
13+
log.SetLevel(log.LevelDebug)
14+
log.Debug("hello debug")
15+
log.Info("hello info")
16+
log.Error("hello error")
717

8-
log.Info("info hello log")
18+
fmt.Println("info level")
19+
log.SetLevel(log.LevelInfo)
20+
log.Debug("hello debug")
21+
log.Info("hello info")
22+
log.Error("hello error")
923

10-
log.Error("error log")
24+
fmt.Println("error level")
25+
log.SetLevel(log.LevelError)
26+
log.Debug("hello debug")
27+
log.Info("hello info")
28+
log.Error("hello error")
1129

1230
}

0 commit comments

Comments
 (0)