* Factor out New Relic logging to DanbooruLogger class. * Log all exceptions to New Relic, not just statement timeouts.
13 lines
400 B
Ruby
13 lines
400 B
Ruby
class DanbooruLogger
|
|
def self.log(exception, expected: false, **params)
|
|
if !expected
|
|
backtrace = Rails.backtrace_cleaner.clean(exception.backtrace).join("\n")
|
|
Rails.logger.error("#{exception.class}: #{exception.message}\n#{backtrace}")
|
|
end
|
|
|
|
if defined?(::NewRelic)
|
|
::NewRelic::Agent.notice_error(exception, expected: expected, custom_params: params)
|
|
end
|
|
end
|
|
end
|