rollbar.go 670 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package logger
  2. import (
  3. "net/http"
  4. "strings"
  5. )
  6. var RollBarEnabled = false
  7. type RollBarStatusCodes []int
  8. var RollBarSkipStatusCodes = RollBarStatusCodes{
  9. http.StatusForbidden,
  10. http.StatusMethodNotAllowed,
  11. http.StatusNotFound,
  12. http.StatusNotModified,
  13. http.StatusOK,
  14. http.StatusTemporaryRedirect,
  15. }
  16. func (r RollBarStatusCodes) contain(status int) bool {
  17. for _, v := range r {
  18. if v == status {
  19. return true
  20. }
  21. }
  22. return false
  23. }
  24. type RollBarErrors []string
  25. var RollBarSkipErrors = RollBarErrors{}
  26. func (r RollBarErrors) contain(str string) bool {
  27. for _, v := range r {
  28. if v == str || strings.Contains(str, v) {
  29. return true
  30. }
  31. }
  32. return false
  33. }