Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup Airbrake for your Sinatra application #9

Open
dombarnes opened this issue Aug 11, 2021 · 0 comments
Open

Setup Airbrake for your Sinatra application #9

dombarnes opened this issue Aug 11, 2021 · 0 comments
Labels

Comments

@dombarnes
Copy link
Owner

Installation

Using bundler

Add the Airbrake gem to your Gemfile:

gem 'airbrake'

Manual

Invoke the following command from your terminal:

gem install airbrake

Configuration

To use Airbrake with Sinatra, simply require the gem, configure it and use our Rack middleware.

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

# myapp.rb
require 'sinatra/base'
require 'airbrake'

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

  # Display debug output.
  c.logger.level = Logger::DEBUG
end

class MyApp < Sinatra::Base
  use Airbrake::Rack::Middleware

  get('/') { 1/0 }
end

run MyApp.run!

Full documentation

For more information please visit our official GitHub repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant