Sha256: c08f60b60a42a6328f0188b2b5070d2d6671e1e0d121cf961daaf8c95936da17

Contents?: true

Size: 618 Bytes

Versions: 10

Compression:

Stored size: 618 Bytes

Contents

module LogjamAgent
  class Middleware
    def initialize(app, options={})
      @app = app
      @options = options
    end

    def call(env)
      start_request(env)
      @app.call(env)
    ensure
      finish_request(env)
    end

    private

    def start_request(env)
      app_name = env["logjam_agent.application_name"] || LogjamAgent.application_name
      env_name = env["logjam_agent.environment_name"] || LogjamAgent.environment_name
      Rails.logger.start_request(app_name, env_name)
    end

    def finish_request(env)
      Rails.logger.finish_request(env["time_bandits.metrics"])
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
logjam_agent-0.3.3 lib/logjam_agent/middleware.rb
logjam_agent-0.3.2 lib/logjam_agent/middleware.rb
logjam_agent-0.3.1 lib/logjam_agent/middleware.rb
logjam_agent-0.3.0 lib/logjam_agent/middleware.rb
logjam_agent-0.2.4 lib/logjam_agent/middleware.rb
logjam_agent-0.2.3 lib/logjam_agent/middleware.rb
logjam_agent-0.2.2 lib/logjam_agent/middleware.rb
logjam_agent-0.2.1 lib/logjam_agent/middleware.rb
logjam_agent-0.2.0 lib/logjam_agent/middleware.rb
logjam_agent-0.1.3 lib/logjam_agent/middleware.rb