Welcome to mirror list, hosted at ThFree Co, Russian Federation.

exception_log_formatter.rb « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9898651c9e3745975a7fc8e248eeea205b1c2801 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 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
        payload['exception.backtrace'] = Rails.backtrace_cleaner.clean(exception.backtrace)
      end
    end
  end
end