class Fluent::SameFileOutput
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_samefile.rb, line 8 def initialize super end
Public Instance Methods
configure(conf)
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_samefile.rb, line 12 def configure(conf) if path = conf['path'] @path = path end unless @path raise ConfigError, "'path' parameter is required on file output" end super FileUtils.mkdir_p File.dirname(@path) @formatter = Plugin.new_formatter(@format) @formatter.configure(conf) end
emit(tag, es, chain, key="")
click to toggle source
# File lib/fluent/plugin/out_samefile.rb, line 38 def emit(tag, es, chain, key="") data = format_stream(tag, es) write(data) end
format(tag, time, record)
click to toggle source
# File lib/fluent/plugin/out_samefile.rb, line 28 def format(tag, time, record) @formatter.format(tag, time, record) end
format_stream(tag, es)
click to toggle source
# File lib/fluent/plugin/out_samefile.rb, line 43 def format_stream(tag, es) out = '' es.each {|time,record| out << format(tag, time, record) } out end
write(data)
click to toggle source
# File lib/fluent/plugin/out_samefile.rb, line 32 def write(data) File.open(@path, "a", DEFAULT_FILE_PERMISSION) do |f| f.write(data) end end