package mylog
import (
"github.com/phachon/go-logger"
)
var Logger *go_logger.Logger
func init() {
Logger = go_logger.NewLogger()
Logger.Detach("console")
consoleConfig := &go_logger.ConsoleConfig{
Format: "%millisecond_format% [%level_string%] [%file%:%line%] %body% ",
}
Logger.Attach("console", go_logger.LOGGER_LEVEL_DEBUG, consoleConfig)
fileConfig := &go_logger.FileConfig{
Filename: "./callcenter.log", // The file name of the logger output, does not exist automatically
// If you want to separate separate logs into files, configure LevelFileName parameters.
DateSlice: "d", // Cut the document by date, support "Y" (year), "m" (month), "d" (day), "H" (hour), default "no".
Format: "%millisecond_format% [%level_string%] [%file%:%line%] %body% ", // JsonFormat is false, logger message written to file format string
}
// add output to the file
Logger.Attach("file", go_logger.LOGGER_LEVEL_DEBUG, fileConfig)
}
日志分割
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 创建脚本 插入定时任务 加入(每天0点执行) 查看定时任务 扩展 crontab日志在这个文件 /var/log/...
- 这一周主要是在写代码吧,没有继续深度学习。内容主要有学会使用Fabric进行部署代码,还有redis的一些操作、p...