Sha256: b7e2348dae00c83fe54ea4e13877735369b633bc7be4171583b88590be380e99
Contents?: true
Size: 1.03 KB
Versions: 3
Compression:
Stored size: 1.03 KB
Contents
# frozen_string_literal: true require 'lograge/formatters/key_value' module Lograge module Formatters class L2met < KeyValue L2MET_FIELDS = %i[ method path format source status error duration view db location ].freeze UNWANTED_FIELDS = %i[ controller action ].freeze def call(data) super(modify_payload(data)) end protected def fields_to_display(data) L2MET_FIELDS + additional_fields(data) end def additional_fields(data) (data.keys - L2MET_FIELDS) - UNWANTED_FIELDS end def format(key, value) key = "measure#page.#{key}" if value.is_a?(Float) super(key, value) 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lograge-0.14.0 | lib/lograge/formatters/l2met.rb |
lograge-0.13.0 | lib/lograge/formatters/l2met.rb |
lograge-0.12.0 | lib/lograge/formatters/l2met.rb |