config.go 1.3 KB

1234567891011121314151617181920212223242526
  1. package logx
  2. // A LogConf is a logging config.
  3. type LogConf struct {
  4. ServiceName string `json:",optional"`
  5. Mode string `json:",default=console,options=[console,file,volume]"`
  6. Encoding string `json:",default=json,options=[json,plain]"`
  7. TimeFormat string `json:",optional"`
  8. Path string `json:",default=logs"`
  9. Level string `json:",default=info,options=[info,error,severe]"`
  10. Compress bool `json:",optional"`
  11. KeepDays int `json:",optional"`
  12. StackCooldownMillis int `json:",default=100"`
  13. // MaxBackups represents how many backup log files will be kept. 0 means all files will be kept forever.
  14. // Only take effect when RotationRuleType is `size`.
  15. // Even thougth `MaxBackups` sets 0, log files will still be removed
  16. // if the `KeepDays` limitation is reached.
  17. MaxBackups int `json:",default=0"`
  18. // MaxSize represents how much space the writing log file takes up. 0 means no limit. The unit is `MB`.
  19. // Only take effect when RotationRuleType is `size`
  20. MaxSize int `json:",default=0"`
  21. // RotationRuleType represents the type of log rotation rule. Default is `daily`.
  22. // daily: daily rotation.
  23. // size: size limited rotation.
  24. Rotation string `json:",default=daily,options=[daily,size]"`
  25. }