2019-12-26 22:10:19 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module ExceptionLogFormatter
|
|
|
|
def self.format!(exception, payload)
|
|
|
|
return unless exception
|
|
|
|
|
|
|
|
# Elasticsearch/Fluentd don't handle nested structures well.
|
|
|
|
# Use periods to flatten the fields.
|
|
|
|
payload.merge!(
|
|
|
|
'exception.class' => exception.class.name,
|
|
|
|
'exception.message' => exception.message
|
|
|
|
)
|
|
|
|
|
|
|
|
if exception.backtrace
|
2020-10-24 23:57:45 +05:30
|
|
|
payload['exception.backtrace'] = Rails.backtrace_cleaner.clean(exception.backtrace)
|
2019-12-26 22:10:19 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|