Refine log settings

This commit is contained in:
v2ray committed 2015-12-05 21:10:14 +01:00
1 parent 32c3565681
commit db7d48e48f
10 files changed
+229 -111

No files matched your search

+28 -2
View File
@@ -1,9 +1,35 @@
package json
import (
"strings"
"github.com/v2ray/v2ray-core/common/log"
)
type LogConfig struct {
AccessLogValue string `json:"access"`
ErrorLogValue string `json:"error"`
LogLevelValue string `json:"loglevel"`
}
func (config *LogConfig) AccessLog() string {
return config.AccessLogValue
func (this *LogConfig) AccessLog() string {
return this.AccessLogValue
}
func (this *LogConfig) ErrorLog() string {
return this.ErrorLogValue
}
func (this *LogConfig) LogLevel() log.LogLevel {
level := strings.ToLower(this.LogLevelValue)
switch level {
case "debug":
return log.DebugLevel
case "info":
return log.InfoLevel
case "error":
return log.ErrorLevel
default:
return log.WarningLevel
}
}