This file is indexed.

/usr/lib/ruby/vendor_ruby/lograge/formatters/ltsv.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
module Lograge
  module Formatters
    class LTSV
      def call(data)
        fields = fields_to_display(data)

        event = fields.map { |key| format(key, data[key]) }
        event.join("\t")
      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 = "'#{escape value}'"
        elsif value.is_a? Float
          value = Kernel.format('%.2f', value)
        end

        "#{key}:#{value}"
      end

      private

      def escape(string)
        value = string.is_a?(String) ? string.dup : string.to_s

        value.gsub!('\\', '\\\\')
        value.gsub!('\n', '\\n')
        value.gsub!('\r', '\\r')
        value.gsub!('\t', '\\t')

        value
      end
    end
  end
end