-
Notifications
You must be signed in to change notification settings - Fork 0
/
mlogger_test.go
37 lines (33 loc) · 890 Bytes
/
mlogger_test.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
33
34
35
36
37
package mlogger
import (
"fmt"
"os"
"testing"
"time"
)
func Test_DLogger(t *testing.T) {
r := func(name string) {
if logId, er := DeclareLog(name, false); er == nil {
if e := SetTextLimit(logId, 20, 10, 12); e != nil {
fmt.Println(e)
os.Exit(0)
}
Verbose(true)
Unroll(true, "test.txt")
Log(logId, LoggerData{"test1", "testing message", []int{2}, true})
Error(logId, LoggerData{"test1", "testing message", []int{2}, true})
Info(logId, LoggerData{"test1", "testing message", []int{2}, false})
Verbose(false)
Warning(logId, LoggerData{"test1", "testing message", []int{2}, true})
Recovered(logId, LoggerData{"test1", "testing message", []int{2}, true})
Panic(logId, LoggerData{"test1", "testing message", []int{}, true}, false)
time.Sleep(5 * time.Second)
} else {
t.Error(er)
}
}
r("test")
r("test1")
r("test2")
r("test3")
}