Skip to content

Instantly share code, notes, and snippets.

@rbarazi
Created July 4, 2012 16:26
Show Gist options
  • Save rbarazi/3048151 to your computer and use it in GitHub Desktop.
Save rbarazi/3048151 to your computer and use it in GitHub Desktop.
Yell Airbrake Adapter
require 'yell'
require 'toadhopper'
class AirbrakeAdapter < Yell::Adapters::Base
setup do |options|
@env = options[:environment]
@airbrake = Toadhopper(options[:api_key])
end
write do |event|
if event.message.respond_to?(:backtrace)
@airbrake.post! event.message, :framework_env => @env
else
begin
raise event.message
rescue => e
@airbrake.post! e, :framework_env => @env
end
end
end
end
# Register the newly written adapter with Yell
Yell::Adapters.register :airbrake, AirbrakeAdapter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment