Sha256: 5046d2f30e69134e7c387a5a72b780d20ec700dbb1e6b61430b56e19e50d6e39
Contents?: true
Size: 878 Bytes
Versions: 14
Compression:
Stored size: 878 Bytes
Contents
require 'lograge/formatters/key_value' module Lograge module Formatters class L2met < KeyValue L2MET_FIELDS = [ :method, :path, :format, :source, :status, :error, :duration, :view, :db, :location ].freeze def call(data) super(modify_payload(data)) end def format(key, value) key = "measure#page.#{key}" if value.is_a?(Float) super(key, value) end def fields_to_display(data) L2MET_FIELDS + (data.keys - L2MET_FIELDS) - [:controller, :action] end def modify_payload(data) data[:source] = source_field(data) if data[:controller] && data[:action] data end def source_field(data) "#{data[:controller].to_s.tr('/', '-')}:#{data[:action]}" end end end end
Version data entries
14 entries across 14 versions & 1 rubygems