Lilypad
Hoptoad notifier for Rack-based frameworks.
Install
sudo gem install lilypad --source http://gemcutter.org
Rails
config/environment.rb
require 'rack/lilypad'
Rails::Initializer.run do |config|
config.middleware.insert_after(ActionController::Failsafe, Rack::Lilypad, 'hoptoad_api_key_goes_here')
end
require 'rack/lilypad/rails'
Sinatra
require 'rack/lilypad'
class MyApp < Sinatra::Application
enable :raise_errors # Not needed when inheriting from Sinatra::Base
use Rack::Lilypad, 'hoptoad_api_key_goes_here'
end
Filters
Don't send certain environment variables to Hoptoad.
use Rack::Lilypad, 'hoptoad_api_key_goes_here' do |hoptoad|
hoptoad.filters << %w(AWS_ACCESS_KEY AWS_SECRET_ACCESS_KEY AWS_ACCOUNT SSH_AUTH_SOCK)
end
Direct Access
Send exceptions to Hoptoad from a rescue block.
begin
raise 'Test'
rescue Exception => e
Rack::Lilypad.notify(e)
end
Log
See what you are sending and receiving from Hoptoad.
use Rack::Lilypad, 'hoptoad_api_key_goes_here' do |hoptoad|
hoptoad.log = '/var/www/log/hoptoad.log'
end
Compatibility
Tested with Ruby 1.8.6, 1.8.7, and 1.9.1.
Thanks
Lilypad wouldn't have happened without rack_hoptoad, toadhopper, Builder, and Nokogiri.