Plain Ruby Mode
In the Rails world it's pretty much expected that when you install a gem it's going to automatically integrate with your application. For instance, many gems provide their own Railtie to run their own code when Rails initializes. The honeybadger gem fully embraces this approach by automatically detecting and integrating with as many 3rd-party gems as possible when it's required:
require 'honeybadger'
Some Rubyists prefer to roll their own integrations, however. They may want to
avoid 3rd-party Monkey patching,
while others aren't using any of the libraries we integrate with and would
rather report errors themselves using Honeybadger.notify
, avoiding unnecessary
initialization at runtime.
To use Honeybadger without the integrations, simply require 'honeybadger/ruby'
instead of the normal require 'honeybadger'
. You will need to configure the
gem from Ruby using Honeybadger.configure
as honeybadger.yml and environment
variable initialization are also skipped:
require 'honeybadger/ruby'
Honeybadger.configure do |config|
config.api_key = "Your project API key"
end
at_exit do
# Wait for asynchronous error notifications before shutting down.
Honeybadger.stop
end
begin
# Failing code
rescue => exception
Honeybadger.notify(exception)
end
See the API Reference for additional methods you can use to integrate Honeybadger with your Ruby project manually.