Skip to content

Latest commit

 

History

History
33 lines (22 loc) · 949 Bytes

logging-to-rollbar.md

File metadata and controls

33 lines (22 loc) · 949 Bytes

Rule

We should not use Rollbar as a logging platform. To do that, use CustomLogger instead.

Example

# bad
def call_api
  response = HTTParty.get('http://example.com')

  Rollbar.error('Example API problem', response: response) unless response.success?
end


# good
def call_api
  response = HTTParty.get('http://example.com')

  CustomLogger.error('Example API problem', response: response) unless response.success?
end

# if you really, really, really, have to use Rollbar, then use it like this
def call_api
  response = HTTParty.get('http://example.com')

  Rollbar.debug('Example API problem', response: response) unless response.success?
end

Reason

Rollbar errors are posted to Slack #errors and when we use Rollbar to log known codepath (not an actual Exception), then we will be spamming the channel with known errors and it will be harder to spot the actual errors.