Created
July 29, 2010 01:02
-
-
Save nuna/496919 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
Index: vendor/plugins/exception_logger/lib/exception_loggable.rb | |
=================================================================== | |
--- vendor/plugins/exception_logger/lib/exception_loggable.rb (revision 2600) | |
+++ vendor/plugins/exception_logger/lib/exception_loggable.rb (working copy) | |
@@ -29,9 +29,18 @@ | |
:exc_date => "%b %d, %Y", | |
:exc_time => "%l:%M %p" | |
}) | |
+ | |
+ target.class_eval do | |
+ cattr_accessor :exception_loggable_except | |
+ end | |
end | |
module ClassMethods | |
+ def log_exception_without(klasses) | |
+ alasses = [klasses] if klasses.kind_of?(Class) | |
+ self.exception_loggable_except = klasses | |
+ end | |
+ | |
def consider_local(*args) | |
local_addresses.concat(args.flatten.map { |a| IPAddr.new(a) }) | |
end | |
@@ -62,7 +71,10 @@ | |
def rescue_action(exception) | |
status = response_code_for_rescue(exception) | |
- log_exception(exception) if status != :not_found | |
+ self.exception_loggable_except ||= [] | |
+ if status != :not_found and not self.exception_loggable_except.include?(exception.class) | |
+ log_exception(exception) | |
+ end | |
super | |
end | |
Index: vendor/plugins/exception_logger/generators/exception_migration/templates/migration.rb | |
=================================================================== | |
--- vendor/plugins/exception_logger/generators/exception_migration/templates/migration.rb (revision 2600) | |
+++ vendor/plugins/exception_logger/generators/exception_migration/templates/migration.rb (working copy) | |
@@ -10,6 +10,8 @@ | |
t.column :request, :text | |
t.column :created_at, :datetime | |
end | |
+ add_index :logged_exceptions, :exception_class | |
+ add_index :logged_exceptions, [:controller_name, :action_name] | |
end | |
def self.down | |
date@karei ~/works/squares/trunk $ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment