-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
32 lines (27 loc) · 861 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package main
import (
"os"
"github.com/tauqeernasir/gcl/gcl"
)
func main() {
l := gcl.NewLogger(os.Stdout).WithTimestamp().WithoutColor()
l.WithFields(gcl.Fields{
"name": "tauqeer",
"email": "tauqeer@g.com",
}).Info("I am an information.")
l.Infof("I am an information (%v=%v)", "key", "value")
l.Warn("I am a warning")
l.Warnf("I am an warning (%v=%v)", "key", "value")
l.Success("I am an error.")
l.Errorf("I am an error (%v=%v)", "key", "value")
lc := gcl.NewLogger(os.Stdout).WithColor().WithPrettyJson()
lc.Info("I am an information.")
lc.Infof("I am an information (%v=%v)", "key", "value")
lc.Warn("I am a warning")
lc.WithFields(gcl.Fields{
"name": "tauqeer",
"email": "tauqeer@g.com",
}).Warnf("I am an warning (%v=%v)", "key", "value")
lc.Success("I am an error.")
lc.Errorf("I am an error (%v=%v)", "key", "value")
}