Sha256: f4de1aee211315a95f927b0980f445bf6cc3a56f1e44aae549be0296346093d3
Contents?: true
Size: 809 Bytes
Versions: 5
Compression:
Stored size: 809 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 ] 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.gsub('/', '-')}:#{data[:action]}" end end end end
Version data entries
5 entries across 5 versions & 2 rubygems