rollbar.go 647 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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.StatusOK,
  10. http.StatusNotModified,
  11. http.StatusTemporaryRedirect,
  12. http.StatusNotFound,
  13. http.StatusMethodNotAllowed,
  14. }
  15. func (r RollBarStatusCodes) contain(status int) bool {
  16. for _, v := range r {
  17. if v == status {
  18. return true
  19. }
  20. }
  21. return false
  22. }
  23. type RollBarErrors []string
  24. var RollBarSkipErrors = RollBarErrors{}
  25. func (r RollBarErrors) contain(str string) bool {
  26. for _, v := range r {
  27. if v == str || strings.Contains(str, v) {
  28. return true
  29. }
  30. }
  31. return false
  32. }