-
Notifications
You must be signed in to change notification settings - Fork 59
/
file.go
54 lines (45 loc) · 1.28 KB
/
file.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
51
52
53
54
package main
import (
"github.com/phachon/go-logger"
)
func main() {
logger := go_logger.NewLogger()
fileConfig := &go_logger.FileConfig{
Filename: "./test.log",
LevelFileName: map[int]string{
logger.LoggerLevel("error"): "./error.log",
logger.LoggerLevel("info"): "./info.log",
logger.LoggerLevel("debug"): "./debug.log",
},
MaxSize: 1024 * 1024,
MaxLine: 10000,
DateSlice: "d",
JsonFormat: false,
Format: "%millisecond_format% [%level_string%] [%file%:%line%] %body%",
}
logger.Attach("file", go_logger.LOGGER_LEVEL_DEBUG, fileConfig)
logger.SetAsync()
i := 0
for {
logger.Emergency("this is a emergency log!")
logger.Alert("this is a alert log!")
logger.Critical("this is a critical log!")
logger.Error("this is a error log!")
logger.Warning("this is a warning log!")
logger.Notice("this is a notice log!")
logger.Info("this is a info log!")
logger.Debug("this is a debug log!")
logger.Emergency("this is a emergency log!")
logger.Notice("this is a notice log!")
logger.Info("this is a info log!")
logger.Debug("this is a debug log!")
logger.Emergency("this is a emergency log!")
logger.Alert("this is a alert log!")
logger.Critical("this is a critical log!")
i += 1
if i == 21000 {
break
}
}
logger.Flush()
}