Sha256: 480e02e041cafbf57cd1e541d6fd7b4b3d13803a96585f92eba2032eaf0058eb

Contents?: true

Size: 800 Bytes

Versions: 9

Compression:

Stored size: 800 Bytes

Contents

# frozen_string_literal: true
require "rails/rack/logger"

# For rails > 3, drop rack Started message to debug level message
# For rails == 3, patch the logger to remove the log lines
# that say: 'Started GET / for 192.168.2.1...'
class Rails::Rack::Logger # rubocop:disable ClassAndModuleChildren

  if Rails::VERSION::MAJOR == 3 && ::Sapience.config.silent_rack
    def call_app(*args)
      env = args.last
      @app.call(env)
    ensure
      ActiveSupport::LogSubscriber.flush_all!
    end
  end

  private

  module Extensions
    def info(*args, &block)
      debug(*args, &block)
    end

    def info?
      debug?
    end
  end

  alias orig_logger logger

  def logger
    @logger ||= begin
      logger = Sapience["Rails"]
      logger.extend(Extensions)
      logger
    end
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
sapience-3.0 lib/sapience/extensions/rails/rack/logger_info_as_debug.rb
sapience-2.15 lib/sapience/extensions/rails/rack/logger_info_as_debug.rb
sapience-2.14 lib/sapience/extensions/rails/rack/logger_info_as_debug.rb
sapience-2.13 lib/sapience/extensions/rails/rack/logger_info_as_debug.rb
sapience-2.12 lib/sapience/extensions/rails/rack/logger_info_as_debug.rb
sapience-2.11 lib/sapience/extensions/rails/rack/logger_info_as_debug.rb
sapience-2.10 lib/sapience/extensions/rails/rack/logger_info_as_debug.rb
sapience-2.9.1 lib/sapience/extensions/rails/rack/logger_info_as_debug.rb
sapience-2.8 lib/sapience/extensions/rails/rack/logger_info_as_debug.rb