Class: Rails::Rack::Logger
- Inherits:
-
ActiveSupport::LogSubscriber
- Object
- ActiveSupport::LogSubscriber
- Rails::Rack::Logger
- Defined in:
- 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.
17 18 19 20 |
# File 'lib/rails/rack/logger.rb', line 17 def initialize(app, taggers = nil) @app = app @taggers = taggers || [] end |
Instance Method Details
#call(env) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/rails/rack/logger.rb', line 22 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 |