Class: Fluent::Tranquility::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/tranquility/formatter.rb

Instance Method Summary collapse

Instance Method Details

#call(_tag, _time, record) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/fluent/tranquility/formatter.rb', line 4

def call(_tag, _time, record)
  begin
    record.to_json + "\n"
  rescue Encoding::UndefinedConversionError
    record.each do |k, v|
      record[k] = v.force_encoding(Encoding::UTF_8)
    end
    return record.to_json + "\n"
  end
end