Sha256: 84727019eb8c2a21e7ed6ee908350b6bff64a3a6c8f1ac114913c89f311c04bc

Contents?: true

Size: 993 Bytes

Versions: 4

Compression:

Stored size: 993 Bytes

Contents

# frozen_string_literal: true

if Rails.env.staging? || Rails.env.production?
  Rails.application.configure do
    config.colorize_logging = false

    config.lograge.enabled = true
    config.lograge.formatter = ::Lograge::Formatters::Raw.new
    config.lograge.base_controller_class = [
      'ActionController::API',
      'ActionController::Base'
    ]

    config.lograge.ignore_actions = ['EIVO::StatusController#index']

    config.lograge.custom_options = ->(event) do
      result = {
        params: event.payload[:params].except('controller', 'action', 'format'),
        request_id: event.payload[:request_id]
      }

      result[:user_id] = event.payload[:user_id] if event.payload[:user_id]
      result[:organization_id] = event.payload[:organization_id] if event.payload[:organization_id]

      # https://github.com/roidrage/lograge/pull/307
      if event.respond_to?(:allocations)
        result[:allocations] = event.allocations
      end

      result
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
eivo-rails-0.1.7 config/initializers/logger.rb
eivo-rails-api-0.1.6 config/initializers/logger.rb
eivo-rails-0.1.6 config/initializers/logger.rb
eivo-rails-api-0.1.5 config/initializers/logger.rb