-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathlogger_test.go
47 lines (34 loc) · 998 Bytes
/
logger_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
package logger
import (
// "runtime"
"strconv"
"fmt"
"testing"
"sync"
"github.com/luoxinliang/go-logger"
)
var wg sync.WaitGroup
func log(i int) {
fmt.Println("log i=", i)
logger.Debug("Debug>>>>>>>>>>>>>>>>>>>>>>" + strconv.Itoa(i))
logger.Debugf("Debug>>>>>>>>>>>>>>>>>>>>>> %d",i)
logger.Info("Info>>>>>>>>>>>>>>>>>>>>>>>>>" + strconv.Itoa(i))
logger.Debugf("Debug>>>>>>>>>>>>>>>>>>>>>> %d",i)
logger.Warn("Warn>>>>>>>>>>>>>>>>>>>>>>>>>" + strconv.Itoa(i))
logger.Warnf("Debug>>>>>>>>>>>>>>>>>>>>>> %d",i)
logger.Error("Error>>>>>>>>>>>>>>>>>>>>>>>>>" + strconv.Itoa(i))
logger.Errorf("Debug>>>>>>>>>>>>>>>>>>>>>> %d",i)
// logger.Fatal("Fatal>>>>>>>>>>>>>>>>>>>>>>>>>" + strconv.Itoa(i))
// logger.Fatalf("Fatal>>>>>>>>>>>>>>>>>>>>>>>>>%d", i)
wg.Done()
}
func Test(t *testing.T) {
logger.Init(".", "test.log", logger.DEBUG)
//指定是否控制台打印,默认为false
// logger.SetConsole(true)
for i := 10; i > 0; i-- {
wg.Add(1)
log(i)
}
wg.Wait()
}