class Honeybadger::Agent

The Honeybadger agent contains all the methods for interacting with the Honeybadger service. It can be used to send notifications to multiple projects in large apps. The global agent instance ({Agent.instance}) should always be accessed through the {Honeybadger} singleton.

=== Context

Context is global by default, meaning agents created via Honeybadger::Agent.new will share context (added via Honeybadger.context or {Honeybadger::Agent#context}) with other agents. This also includes the Rack environment when using the {Honeybadger::Rack::ErrorNotifier} middleware. To localize context for a custom agent, use the +local_context: true+ option when initializing.

@example

# Standard usage:
OtherBadger = Honeybadger::Agent.new

# With local context:
OtherBadger = Honeybadger::Agent.new(local_context: true)

OtherBadger.configure do |config|
  config.api_key = 'project api key'
end

begin
  # Risky operation
rescue => e
  OtherBadger.notify(e)
end