newrelic: refactor error logging.

* Factor out New Relic logging to DanbooruLogger class.
* Log all exceptions to New Relic, not just statement timeouts.
This commit is contained in:
evazion
2019-08-08 22:16:39 -05:00
parent 35dfc704bc
commit 9a6add9730
9 changed files with 27 additions and 37 deletions

View File

@@ -41,13 +41,7 @@ module Maintenance
end
def rescue_exception(exception)
backtrace = Rails.backtrace_cleaner.clean(exception.backtrace).join("\n")
Rails.logger.error("#{exception.class}: #{exception.message}\n#{backtrace}")
if defined?(NewRelic::Agent)
NewRelic::Agent.notice_error(exception, custom_params: { backtrace: backtrace })
end
DanbooruLogger.log(exception)
raise exception
end
end