9 Star 36 Fork 13

phachon / go-logger

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
file.go 1.28 KB
一键复制 编辑 Web IDE 原始数据 按行查看 历史
phachon 提交于 2019-12-15 11:20 . update go mod
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()
}
Go
1
https://gitee.com/phachon/go-logger.git
git@gitee.com:phachon/go-logger.git
phachon
go-logger
go-logger
master

搜索帮助

14c37bed 8189591 565d56ea 8189591