独立日志文件添加门面方法

This commit is contained in:
zhucheer 2019-12-27 11:29:15 +08:00
parent 523bce41ca
commit a3610c56c1
3 changed files with 8 additions and 3 deletions

View File

@ -41,6 +41,12 @@ func NewLogger() {
LevelString[level], loggerType, loggerSyncInterval))
}
// LogFile, new log file save.
func LogFile(fileName string) *Logger {
checkLogNil()
return logFacede.LogFile(fileName)
}
// Debug, record DEBUG message.
func Debug(format string, a ...interface{}) {
checkLogNil()

View File

@ -8,7 +8,7 @@
[app.logger]
level = "INFO"
type = "text"
path = ""
path = "./logs"
syncInterval = 2
[app.session]
isOpen = true

View File

@ -26,8 +26,7 @@ func AuthCheck(c *app.Context) error {
func Test(c *app.Context) error {
opennum := cfg.GetIntFlag("opennum")
logger.Error("error logs %d", opennum)
logger.LogFile("api").Error("error logs %d", opennum)
return c.ToJson(map[string]interface{}{
"test": "123",
})