Merge pull request #1739 from boypt/nonelogger

add: mute access/error logger seperately
pull/2392/head^2
Kslr 2019-06-11 16:04:32 +08:00 committed by GitHub
commit 4c93d36d49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -30,11 +30,15 @@ func (v *LogConfig) Build() *log.Config {
AccessLogType: log.LogType_Console, AccessLogType: log.LogType_Console,
} }
if len(v.AccessLog) > 0 { if v.AccessLog == "none" {
config.AccessLogType = log.LogType_None
} else if len(v.AccessLog) > 0 {
config.AccessLogPath = v.AccessLog config.AccessLogPath = v.AccessLog
config.AccessLogType = log.LogType_File config.AccessLogType = log.LogType_File
} }
if len(v.ErrorLog) > 0 { if v.ErrorLog == "none" {
config.ErrorLogType = log.LogType_None
} else if len(v.ErrorLog) > 0 {
config.ErrorLogPath = v.ErrorLog config.ErrorLogPath = v.ErrorLog
config.ErrorLogType = log.LogType_File config.ErrorLogType = log.LogType_File
} }