Sha256: 6598fd6a51671a44a12efbf247ea44b5ac0f85752600fc4dbbe9d4c88359f8ca

Contents?: true

Size: 928 Bytes

Versions: 3

Compression:

Stored size: 928 Bytes

Contents

# frozen_string_literal: true

require 'lograge'

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 = event.payload.dup || {}

      result.delete(:headers)

      # Removed because already present in event.payload
      if result[:params]
        result[:params] = result[:params].except('controller', 'action', 'format')
      end

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

      result
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
eivo-rails-api-0.1.14 config/initializers/logger.rb
eivo-rails-0.1.12 config/initializers/logger.rb
eivo-rails-api-0.1.13 config/initializers/logger.rb