Class: Loga::Rack::Logger

Inherits:
Object
  • Object
show all
Includes:
Utilities
Defined in:
lib/loga/rack/logger.rb

Instance Method Summary collapse

Methods included from Utilities

#duration_in_ms

Constructor Details

#initialize(app) ⇒ Logger

Returns a new instance of Logger.



6
7
8
# File 'lib/loga/rack/logger.rb', line 6

def initialize(app)
  @app = app
end

Instance Method Details

#call(env, started_at = Time.now) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/loga/rack/logger.rb', line 10

def call(env, started_at = Time.now)
  request = Loga::Rack::Request.new(env)
  env['loga.request.original_path'] = request.path

  if logger.respond_to?(:tagged)
    logger.tagged(compute_tags(request)) { call_app(request, env, started_at) }
  else
    call_app(request, env, started_at)
  end
end