config.go 471 B

12345678910111213141516171819202122232425
  1. package log
  2. func (this *Config) Apply() error {
  3. if this == nil {
  4. return nil
  5. }
  6. if this.AccessLogType == LogType_File {
  7. if err := InitAccessLogger(this.AccessLogPath); err != nil {
  8. return err
  9. }
  10. }
  11. if this.ErrorLogType == LogType_None {
  12. SetLogLevel(LogLevel_Disabled)
  13. } else {
  14. if this.ErrorLogType == LogType_File {
  15. if err := InitErrorLogger(this.ErrorLogPath); err != nil {
  16. return err
  17. }
  18. }
  19. SetLogLevel(this.ErrorLogLevel)
  20. }
  21. return nil
  22. }