Class: Logcraft::Rails::RequestIdLogger

Inherits:
Object
  • Object
show all
Includes:
LogContextHelper
Defined in:
lib/logcraft/rails/request_id_logger.rb

Instance Method Summary collapse

Methods included from LogContextHelper

#add_to_log_context, #within_log_context

Constructor Details

#initialize(app) ⇒ RequestIdLogger

Returns a new instance of RequestIdLogger.



8
9
10
# File 'lib/logcraft/rails/request_id_logger.rb', line 8

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
# File 'lib/logcraft/rails/request_id_logger.rb', line 12

def call(env)
  within_log_context request_id: env['action_dispatch.request_id'] do
    @app.call env
  end
end