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)
}
网友评论