learningtapestry / CredentialRegistry

Repository for development of the Credential Registry
Apache License 2.0
0 stars 1 forks source link

Setup Airbrake for your Ruby application #13

Open edgarf opened 4 years ago

edgarf commented 4 years ago

Installation

Option 1: Bundler

Add the Airbrake Ruby gem to your Gemfile:

gem 'airbrake-ruby'

Option 2: Manual

Invoke the following command from your terminal:

gem install airbrake-ruby

Configuration

Just require the library and copy this configuration snippet into your Ruby project:

(You can find your project ID and API key in your project's settings)

require 'airbrake-ruby'

Airbrake.configure do |c|
  c.project_id = <Your project ID>
  c.project_key = '<Your project API KEY>'
end

Uncaught errors are automatically sent to Airbrake. Caught errors can be sent to Airbrake using the notify method:

begin
  1/0
rescue ZeroDivisionError => ex
  Airbrake.notify(ex)
end

Configuration

For in depth examples and advanced configuration options like error filtering or custom parameters, please visit our official GitHub repo.