Class: Rails::Rack::Logger

Inherits:
ActiveSupport::LogSubscriber
  • Object
show all
Defined in:
lib/rails/rack/logger.rb

Overview

Log the request started and flush all loggers after it.

Instance Method Summary collapse

Constructor Details

#initialize(app, tags = nil) ⇒ Logger

Returns a new instance of Logger.



8
9
10
# File 'lib/rails/rack/logger.rb', line 8

def initialize(app, tags=nil)
  @app, @tags = app, tags.presence
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/rails/rack/logger.rb', line 12

def call(env)
  if @tags
    Rails.logger.tagged(compute_tags(env)) { call_app(env) }
  else
    call_app(env)
  end
end