class Fluent::TextFormatter::JSONishFormatter
Public Instance Methods
format(tag, time, record)
click to toggle source
Calls superclass method
# File lib/fluent/plugin/formatter_jsonish.rb, line 35 def format(tag, time, record) super(*update_entry(tag, time, record)) end
format_without_nl(tag, time, record)
click to toggle source
Calls superclass method
# File lib/fluent/plugin/formatter_jsonish.rb, line 39 def format_without_nl(tag, time, record) super(*update_entry(tag, time, record)) end
update_entry(tag, time, record)
click to toggle source
# File lib/fluent/plugin/formatter_jsonish.rb, line 13 def update_entry(tag, time, record) merge_hash = {} if @add_time.key?('key') if not @add_time.key?('format') or @add_time['format'] == 'iso8601(3)' merge_hash[@add_time['key']] = Time.at(time.to_r).iso8601(3) else merge_hash[@add_time['key']] = eval("Time.at(time.to_r).#{@add_time['format']}") end end if @add_tag.key?('key') if not @add_tag.key?('format') or @add_tag['format'] == 'to_s' merge_hash[@add_tag['key']] = tag.to_s else merge_hash[@add_tag['key']] = eval("tag.#{@add_tag['format']}") end end return tag, time, record.merge(merge_hash) end