Sha256: 79d7d3abd6524bcb4c9cedbe9f461aa6393ffa957b16ab636950d1cf62e9e47b

Contents?: true

Size: 446 Bytes

Versions: 1

Compression:

Stored size: 446 Bytes

Contents

# frozen_string_literal: true

require 'request_store'

module Marlowe
  # Marlowe::Formatter is a subclass of +ActiveSupport::Logger::Formatter+
  # that adds a correlation id string to a rails log.
  class Formatter < ActiveSupport::Logger::Formatter
    # Overrides the formatter return to add the correlation id.
    def call(_severity, _timestamp, _progname, _msg)
      "[#{RequestStore.store[:correlation_id]}] #{super}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
marlowe-2.0 lib/marlowe/formatter.rb