Sha256: 3525f14b155fcbfe1b7eb52718124ca147a18ac229676356a143becdfbbc63d5

Contents?: true

Size: 507 Bytes

Versions: 3

Compression:

Stored size: 507 Bytes

Contents

# frozen_string_literal: true

# Rack middleware that adds basic request metadata to all log lines.

module Loggery
  module Metadata
    module Middleware
      class Rack
        def initialize(app)
          @app = app
        end

        def call(env)
          Loggery::Metadata::Store.with_metadata(worker_type: "web",
                                                 request_id:  env["action_dispatch.request_id"]) do
            @app.call(env)
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
loggery-0.3.0 lib/loggery/metadata/middleware/rack.rb
loggery-0.2.1 lib/loggery/metadata/middleware/rack.rb
loggery-0.2.0 lib/loggery/metadata/middleware/rack.rb