Sha256: 77e95446e11d5fdeaecb1e9f5144c609e76ab9f4f256f738213137289b136692

Contents?: true

Size: 439 Bytes

Versions: 1

Compression:

Stored size: 439 Bytes

Contents

require "request_store"

module Marlowe
  # Marlowe::SimpleFormatter is a subclass of
  # +ActiveSupport::Logger::SimpleFormatter+ that adds a correlation id
  # string to a rails log.
  class SimpleFormatter < ActiveSupport::Logger::SimpleFormatter
    # 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.1 lib/marlowe/simple_formatter.rb