Class: TimeBandits::Rack::Logger
- Inherits:
-
ActiveSupport::LogSubscriber
- Object
- ActiveSupport::LogSubscriber
- TimeBandits::Rack::Logger
- Defined in:
- lib/time_bandits/rack/logger40.rb,
lib/time_bandits/rack/logger.rb
Overview
Sets log tags, logs the request, calls the app, and flushes the logs.
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.
4 5 6 7 |
# File 'lib/time_bandits/rack/logger.rb', line 4 def initialize(app, taggers=nil) @app = app @taggers = taggers || Rails.application.config. || [] end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/time_bandits/rack/logger.rb', line 9 def call(env) request = ActionDispatch::Request.new(env) if logger.respond_to?(:tagged) && !@taggers.empty? logger.tagged((request)) { call_app(request, env) } else call_app(request, env) end end |