Sha256: aaf512d7ba4688bd4cb1dc33e09e012c89a59ce8ba9bb4b3de065cf18c5c600f
Contents?: true
Size: 768 Bytes
Versions: 24
Compression:
Stored size: 768 Bytes
Contents
module Lograge module Formatters class Graylog2 def call(data) # Cloning because we don't want to mess with the original when mutating keys. data_clone = data.clone base = { short_message: short_message(data_clone) } # Add underscore to every key to follow GELF additional field syntax. data_clone.keys.each do |key| data_clone[underscore_prefix(key)] = data_clone[key] data_clone.delete(key) end data_clone.merge(base) end def underscore_prefix(key) "_#{key}".to_sym end def short_message(data) "[#{data[:status]}] #{data[:method]} #{data[:path]} (#{data[:controller]}##{data[:action]})" end end end end
Version data entries
24 entries across 24 versions & 2 rubygems