class Lograge::Formatters::L2met

Constants

L2MET_FIELDS
UNWANTED_FIELDS

Public Instance Methods

call(data) click to toggle source
Calls superclass method Lograge::Formatters::KeyValue#call
# File lib/lograge/formatters/l2met.rb, line 24
def call(data)
  super(modify_payload(data))
end

Protected Instance Methods

additional_fields(data) click to toggle source
# File lib/lograge/formatters/l2met.rb, line 34
def additional_fields(data)
  (data.keys - L2MET_FIELDS) - UNWANTED_FIELDS
end
fields_to_display(data) click to toggle source
# File lib/lograge/formatters/l2met.rb, line 30
def fields_to_display(data)
  L2MET_FIELDS + additional_fields(data)
end
format(key, value) click to toggle source
Calls superclass method Lograge::Formatters::KeyValue#format
# File lib/lograge/formatters/l2met.rb, line 38
def format(key, value)
  key = "measure#page.#{key}" if value.is_a?(Float)

  super(key, value)
end
modify_payload(data) click to toggle source
# File lib/lograge/formatters/l2met.rb, line 44
def modify_payload(data)
  data[:source] = source_field(data) if data[:controller] && data[:action]

  data
end
source_field(data) click to toggle source
# File lib/lograge/formatters/l2met.rb, line 50
def source_field(data)
  "#{data[:controller].to_s.tr('/', '-')}:#{data[:action]}"
end