Sha256: 9bff38b3dfb7bf93412905156a5dd94f0d77277919b390850a9a636e4d6710f2
Contents?: true
Size: 655 Bytes
Versions: 14
Compression:
Stored size: 655 Bytes
Contents
module Lograge module Formatters class KeyValue def call(data) fields = fields_to_display(data) event = fields.map { |key| format(key, data[key]) } event.join(' ') end def fields_to_display(data) data.keys end def format(key, value) if key == :error # Exactly preserve the previous output # Parsing this can be ambigious if the error messages contains # a single quote value = "'#{value}'" elsif value.is_a? Float value = Kernel.format('%.2f', value) end "#{key}=#{value}" end end end end
Version data entries
14 entries across 14 versions & 1 rubygems