Class: Logman::Rails
- Inherits:
-
Object
- Object
- Logman::Rails
- Defined in:
- lib/logman_rails.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Rails
constructor
A new instance of Rails.
Constructor Details
Class Method Details
.default_ignore_exceptions ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/logman_rails.rb', line 21 def self.default_ignore_exceptions [].tap do |exceptions| exceptions << ActiveRecord::RecordNotFound if defined? ActiveRecord # exceptions << AbstractController::ActionNotFound if defined? AbstractController exceptions << ActionController::RoutingError if defined? ActionController end end |
Instance Method Details
#call(env) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/logman_rails.rb', line 35 def call(env) @app.call(env) rescue Exception => exception = (env['exception_notifier.options'] ||= {}) .reverse_merge!(@options) raise exception if [:endpoint].nil? || [:token].nil? unless Array.wrap([:ignore_exceptions]).include?(exception.class) # Notifier.exception_notification(env, exception).deliver # env['exception_notifier.delivered'] = true newlog = Log.new newlog. = exception.to_s data = {} data[:exception_class] = exception.class.name data[:backtrace] = exception.backtrace data[:params] = env["action_dispatch.request.parameters"] newlog.data = data Logman.send(newlog, [:endpoint], [:token]) end raise exception end |