-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlog_test.go
More file actions
46 lines (38 loc) · 773 Bytes
/
log_test.go
File metadata and controls
46 lines (38 loc) · 773 Bytes
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package glog
import (
"os"
"testing"
)
func TestExampleLog(t *testing.T) {
Printf("print")
Tracef("trace")
Debugf("debug")
Infof("info")
Errorf("error")
Fatalf("fatal")
DefaultLogger().Level = INFO
Tracef("trace")
Debugf("debug")
Infof("info")
Errorf("error")
Fatalf("fatal")
DefaultLogger().Colorful = false
Tracef("trace")
Debugf("debug")
Infof("info")
Errorf("error")
Fatalf("fatal")
NewNamedLogger("named", os.Stdout)
nl := GetLogger("named")
nl.Tracef("trace, %d", 1)
nl.Debugf("debug, %d", 2)
nl.Infof("info, %d", 3)
nl.Errorf("error, %d", 4)
nl.Fatalf("fatal, %d", 5)
sl := nl.SetPrefix("STAT")
sl.Tracef("trace, %d", 1)
sl.Debugf("debug, %d", 2)
sl.Infof("info, %d", 3)
sl.Errorf("error, %d", 4)
sl.Fatalf("fatal, %d", 5)
}