2016-10-03 20:07:28 +00:00
|
|
|
package log
|
|
|
|
|
2016-11-27 20:39:09 +00:00
|
|
|
func (v *Config) Apply() error {
|
|
|
|
if v == nil {
|
2016-10-03 20:07:28 +00:00
|
|
|
return nil
|
|
|
|
}
|
2016-11-27 20:39:09 +00:00
|
|
|
if v.AccessLogType == LogType_File {
|
|
|
|
if err := InitAccessLogger(v.AccessLogPath); err != nil {
|
2016-10-03 20:07:28 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-27 20:39:09 +00:00
|
|
|
if v.ErrorLogType == LogType_None {
|
2016-10-03 20:07:28 +00:00
|
|
|
SetLogLevel(LogLevel_Disabled)
|
|
|
|
} else {
|
2016-11-27 20:39:09 +00:00
|
|
|
if v.ErrorLogType == LogType_File {
|
|
|
|
if err := InitErrorLogger(v.ErrorLogPath); err != nil {
|
2016-10-03 20:07:28 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
2016-11-27 20:39:09 +00:00
|
|
|
SetLogLevel(v.ErrorLogLevel)
|
2016-10-03 20:07:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|