1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-05 08:56:49 -05:00
v2fly/shell/point/json/log.go

36 lines
640 B
Go
Raw Normal View History

2015-10-29 18:41:37 -04:00
package json
2015-12-05 15:10:14 -05:00
import (
"strings"
"github.com/v2ray/v2ray-core/common/log"
)
2015-10-29 18:41:37 -04:00
type LogConfig struct {
AccessLogValue string `json:"access"`
2015-12-05 15:10:14 -05:00
ErrorLogValue string `json:"error"`
LogLevelValue string `json:"loglevel"`
}
func (this *LogConfig) AccessLog() string {
return this.AccessLogValue
}
func (this *LogConfig) ErrorLog() string {
return this.ErrorLogValue
2015-10-29 18:41:37 -04:00
}
2015-12-05 15:10:14 -05:00
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
}
2015-10-29 18:41:37 -04:00
}