yamldef.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package main
  2. type FrontendConfigYAML struct {
  3. CommonConfig CommonConfigYAML `yaml:"common"`
  4. LogConfig LogConfigYAML `yaml:"log"`
  5. }
  6. type CommonConfigYAML struct {
  7. IsDebugModeOn bool `yaml:"debug"`
  8. RedirectWhen404 bool `yaml:"redirect_when_404"`
  9. RedirectURL string `yaml:"redirect_url"`
  10. IsBackendProxyEnable bool `yaml:"backend_proxy_enable"`
  11. }
  12. type LogConfigYAML struct {
  13. AccessLogEnable bool `yaml:"access_log_enable"`
  14. RollingLogConfig RollingLoggerConfigYAML `yaml:"rolling_log_config"`
  15. AccessLoggerDetailConfig AccessLoggerConfigYAML `yaml:"access_log_config"`
  16. ErrorLoggerDetailConfig ErrorLoggerConfigYAML `yaml:"error_log_config"`
  17. }
  18. type RollingLoggerConfigYAML struct {
  19. ErrLogCfg LumberjackLoggerYAML `yaml:"error_log"`
  20. AccessLogCfg LumberjackLoggerYAML `yaml:"access_log"`
  21. }
  22. type LumberjackLoggerYAML struct {
  23. FileName string `yaml:"file"`
  24. MaxSize int `yaml:"max_size"`
  25. MaxAge int `yaml:"max_age"`
  26. MaxBackups int `yaml:"max_backups"`
  27. UseLocalTime bool `yaml:"use_local_time"`
  28. Compress bool `yaml:"compress_history"`
  29. }
  30. type AccessLoggerConfigYAML struct {
  31. OutputLevel string `yaml:"output_level"`
  32. SuccessLevel string `yaml:"success_level"`
  33. NotFoundLevel string `yaml:"not_found_level"`
  34. ForbiddenLevel string `yaml:"forbidden_level"`
  35. GatewayErrorLevel string `yaml:"gateway_error_level"`
  36. InternalErrorLevel string `yaml:"internal_error_level"`
  37. OtherStatusLevel string `yaml:"other_status_level"`
  38. LogFormat string `yaml:"log_format"`
  39. UseUTC bool `yame:"use_utc"`
  40. }
  41. type ErrorLoggerConfigYAML struct {
  42. OutputLevel string `yaml:"output_level"`
  43. LogFormat string `yaml:"log_format"`
  44. UseUTC bool `yame:"use_utc"`
  45. }