class LogRaider::Interceptor

Public Class Methods

new() click to toggle source
# File lib/log_raider.rb, line 5
def initialize
  @real_logger = Rails.logger
end

Public Instance Methods

error_with_newrelic_reporting(message) click to toggle source
# File lib/log_raider.rb, line 11
def error_with_newrelic_reporting(message)
  return_value = error_without_newrelic_reporting(message)
  NewRelic::Agent.notice_error(Exception.new("From Rails error log: #{message}"))
  return_value
end
intercept!() click to toggle source
# File lib/log_raider.rb, line 9
def intercept!
  @real_logger.class_eval do
    def error_with_newrelic_reporting(message)
      return_value = error_without_newrelic_reporting(message)
      NewRelic::Agent.notice_error(Exception.new("From Rails error log: #{message}"))
      return_value
    end

    alias_method :error_without_newrelic_reporting, :error
    alias_method :error, :error_with_newrelic_reporting
  end
end