Class: Rails::Rack::Logger
- Inherits:
-
ActiveSupport::LogSubscriber
- Object
- ActiveSupport::LogSubscriber
- Rails::Rack::Logger
- Defined in:
- railties/lib/rails/rack/logger.rb
Overview
Sets log tags, logs the request, calls the app, and flushes the logs.
Log tags (taggers
) can be an Array containing: methods that the request
object responds to, objects that respond to to_s
or Proc objects that accept an instance of the request
object.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, taggers = nil) ⇒ Logger
constructor
A new instance of Logger.
Constructor Details
#initialize(app, taggers = nil) ⇒ Logger
Returns a new instance of Logger.
15 16 17 18 |
# File 'railties/lib/rails/rack/logger.rb', line 15 def initialize(app, taggers = nil) @app = app @taggers = taggers || [] end |
Instance Method Details
#call(env) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'railties/lib/rails/rack/logger.rb', line 20 def call(env) request = ActionDispatch::Request.new(env) if logger.respond_to?(:tagged) logger.tagged(*(request)) { call_app(request, env) } else call_app(request, env) end end |