mirror of https://github.com/v2ray/v2ray-core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
640 B
36 lines
640 B
9 years ago
|
package json
|
||
|
|
||
9 years ago
|
import (
|
||
|
"strings"
|
||
|
|
||
|
"github.com/v2ray/v2ray-core/common/log"
|
||
|
)
|
||
|
|
||
9 years ago
|
type LogConfig struct {
|
||
|
AccessLogValue string `json:"access"`
|
||
9 years ago
|
ErrorLogValue string `json:"error"`
|
||
|
LogLevelValue string `json:"loglevel"`
|
||
|
}
|
||
|
|
||
|
func (this *LogConfig) AccessLog() string {
|
||
|
return this.AccessLogValue
|
||
|
}
|
||
|
|
||
|
func (this *LogConfig) ErrorLog() string {
|
||
|
return this.ErrorLogValue
|
||
9 years ago
|
}
|
||
|
|
||
9 years ago
|
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
|
||
|
}
|
||
9 years ago
|
}
|