Class: Lumberjack::Rails::ContextMiddleware

Inherits:
Object
  • Object
show all
Defined in:
lib/lumberjack/rails/context_middleware.rb

Overview

This Rack middleware provides a Lumberjack context for each request.

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ ContextMiddleware

Returns a new instance of ContextMiddleware.

Parameters:

  • app (#call)

    The Rack application.



8
9
10
# File 'lib/lumberjack/rails/context_middleware.rb', line 8

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Array

Process a request through the middleware stack with Lumberjack context.

Parameters:

  • env (Hash)

    the Rack environment hash

Returns:

  • (Array)

    the Rack response array



16
17
18
19
20
# File 'lib/lumberjack/rails/context_middleware.rb', line 16

def call(env)
  Lumberjack::Rails.logger_context do
    @app.call(env)
  end
end