高热共公日志库
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.

54 lines
1.1 KiB

  1. package grlogs
  2. import (
  3. "bytes"
  4. "encoding/json"
  5. )
  6. type ConsoleLogConfig struct {
  7. Level int `json:"level"`
  8. }
  9. func (c *ConsoleLogConfig) String() string {
  10. b, _ := json.Marshal(c)
  11. return bytes.NewBuffer(b).String()
  12. }
  13. type FileLogConfig struct {
  14. Filename string `json:"filename"`
  15. Level int `json:"level"`
  16. Maxlines int `json:"maxlines"`
  17. Daily bool `json:"daily"`
  18. Maxdays int `json:"maxdays"`
  19. Color bool `json:"color"`
  20. Rotate bool `json:"rotate"`
  21. }
  22. func (c *FileLogConfig) String() string {
  23. b, _ := json.Marshal(c)
  24. return bytes.NewBuffer(b).String()
  25. }
  26. type ConnLogConfig struct {
  27. ReconnectOnMsg bool `json:"reconnect_on_msg"`
  28. Reconnect bool `json:"reconnect"`
  29. Net string `json:"net"`
  30. Addr string `json:"addr"`
  31. Level int `json:"level"`
  32. }
  33. func (c *ConnLogConfig) String() string {
  34. b, _ := json.Marshal(c)
  35. return bytes.NewBuffer(b).String()
  36. }
  37. type EsConfig struct {
  38. Dsn string `json:"dsn"`
  39. Level int `json:"level"`
  40. }
  41. func (c *EsConfig) String() string {
  42. b, _ := json.Marshal(c)
  43. return bytes.NewBuffer(b).String()
  44. }