class Fluent::Plugin::StdoutOutput
Constants
- DEFAULT_FORMAT_TYPE
- TIME_FORMAT
Attributes
delayed[RW]
Public Class Methods
new()
click to toggle source
Calls superclass method
Fluent::Compat::Output.new
# File lib/fluent/plugin/out_stdout.rb, line 48 def initialize super @delayed = false end
Public Instance Methods
configure(conf)
click to toggle source
Calls superclass method
Fluent::Compat::Output#configure
# File lib/fluent/plugin/out_stdout.rb, line 53 def configure(conf) if conf['output_type'] && !conf['format'] conf['format'] = conf['output_type'] end compat_parameters_convert(conf, :inject, :formatter) super @formatter = formatter_create(conf: conf.elements('format').first, default_type: DEFAULT_FORMAT_TYPE) end
format(tag, time, record)
click to toggle source
# File lib/fluent/plugin/out_stdout.rb, line 71 def format(tag, time, record) record = inject_values_to_record(tag, time, record) "#{Time.at(time).localtime.strftime(TIME_FORMAT)} #{tag}: #{@formatter.format(tag, time, record).chomp}\n" end
prefer_buffered_processing()
click to toggle source
# File lib/fluent/plugin/out_stdout.rb, line 38 def prefer_buffered_processing false end
prefer_delayed_commit()
click to toggle source
# File lib/fluent/plugin/out_stdout.rb, line 42 def prefer_delayed_commit @delayed end
process(tag, es)
click to toggle source
# File lib/fluent/plugin/out_stdout.rb, line 64 def process(tag, es) es.each {|time,record| $log.write(format(tag, time, record)) } $log.flush end
try_write(chunk)
click to toggle source
# File lib/fluent/plugin/out_stdout.rb, line 80 def try_write(chunk) chunk.write_to($log) commit_write(chunk.unique_id) end
write(chunk)
click to toggle source
# File lib/fluent/plugin/out_stdout.rb, line 76 def write(chunk) chunk.write_to($log) end