/usr/lib/ruby/vendor_ruby/lograge/formatters/l2met.rb is in ruby-lograge 0.5.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | require 'lograge/formatters/key_value'
module Lograge
module Formatters
class L2met < KeyValue
L2MET_FIELDS = [
:method,
:path,
:format,
:source,
:status,
:error,
:duration,
:view,
:db,
:location
].freeze
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.tr('/', '-')}:#{data[:action]}"
end
end
end
end
|