Created
October 19, 2010 21:47
-
-
Save leobessa/635206 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SQLGrowler | |
class Subscriber < ActiveRecord::LogSubscriber | |
def sql(event) | |
super | |
g = Growl.new("localhost", "ruby-growl", ["ruby-growl Notification"], ["ruby-growl Notification"], nil) | |
g.notify('ruby-growl Notification',application_name,'%s (%.1fms) %s' % [event.payload[:name], event.duration, event.payload[:sql].squeeze(' ')],1,true) | |
end | |
def application_name | |
@application_name ||= Rails.application.class.parent_name | |
end | |
end | |
end | |
SQLGrowler::Subscriber.attach_to :active_record |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment