Sha256: 2f1ad4fab21bbfd6aca44449dabe1ae64e25aa891a65a2dd1b1a9934d3d22d43

Contents?: true

Size: 503 Bytes

Versions: 1

Compression:

Stored size: 503 Bytes

Contents

require 'lograge'
require 'lograge_tagged/version'

module LogrageTagged
  class TaggedKeyValueFormatter < Lograge::Formatters::KeyValue
    def call(data)
      "[request.app] #{super}"
    end
  end

  class Railtie < Rails::Railtie
    initializer "lograge-tagged", before: :lograge do |app|
      app.config.lograge.formatter = LogrageTagged::TaggedKeyValueFormatter.new
      app.config.lograge.custom_options = ->(event) { { params: event.payload[:params] } }
    end
  end if defined?(Rails)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lograge-tagged-0.2.0 lib/lograge_tagged.rb