-
Notifications
You must be signed in to change notification settings - Fork 0
/
zlogger_test.go
50 lines (42 loc) · 863 Bytes
/
zlogger_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
38
39
40
41
42
43
44
45
46
47
48
49
50
package zlogger
import (
"fmt"
"testing"
"time"
"go.uber.org/zap"
)
func TestNewLogger(t *testing.T) {
logger := NewLogger(Options{
LogPath: "",
FileName: "",
MaxSize: 0,
MaxAge: 0,
MaxBackups: 0,
})
fmt.Printf("logger: %#v\n", logger)
}
func TestLogger_Default(t *testing.T) {
logger := NewLogger(Options{
Mode: "dev",
LogPath: "storage/logs",
FileName: "",
MaxSize: 10,
MaxAge: 10,
MaxBackups: 10,
})
defer logger.Sync()
logger.Default().Info("HelloWords!")
logger.Default().Debug("this is debug", zap.Time("loadTime", time.Now()))
}
func TestLogger_Store(t *testing.T) {
logger := NewLogger(Options{
//Mode: "dev",
LogPath: "",
FileName: "",
MaxSize: 10,
MaxAge: 10,
MaxBackups: 20,
})
defer logger.Sync()
logger.Store("storeTest").Debug("store test")
}