Sha256: 53ea4337e34aebc3117f69287cbcf1397d9ed6ef0c519cad3b504caac0043183

Contents?: true

Size: 414 Bytes

Versions: 26

Compression:

Stored size: 414 Bytes

Contents

# frozen_string_literal: true

require 'logger'

require_relative 'constants'

module Rack
  # Sets up rack.logger to write to rack.errors stream
  class Logger
    def initialize(app, level = ::Logger::INFO)
      @app, @level = app, level
    end

    def call(env)
      logger = ::Logger.new(env[RACK_ERRORS])
      logger.level = @level

      env[RACK_LOGGER] = logger
      @app.call(env)
    end
  end
end

Version data entries

26 entries across 25 versions & 6 rubygems

Version Path
rack-3.0.2 lib/rack/logger.rb
tdiary-5.2.4 vendor/bundle/ruby/3.1.0/gems/rack-3.0.1/lib/rack/logger.rb
rack-3.0.1 lib/rack/logger.rb
rack-3.0.0 lib/rack/logger.rb
rack-3.0.0.rc1 lib/rack/logger.rb
rack-3.0.0.beta1 lib/rack/logger.rb