class Fluent::FileOutputWithFixPath

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_file_with_fix_path.rb, line 7
def initialize
  require 'time'
  super
end

Public Instance Methods

configure(conf) click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_file_with_fix_path.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
  conf['buffer_path'] ||= @path
  super

  @formatter = Plugin.new_formatter(@format)
  @formatter.configure(conf)

end
format(tag, time, record) click to toggle source
# File lib/fluent/plugin/out_file_with_fix_path.rb, line 27
def format(tag, time, record)
  @formatter.format(tag, time, record)
end
secondary_init(primary) click to toggle source
# File lib/fluent/plugin/out_file_with_fix_path.rb, line 38
def secondary_init(primary)
  # don't warn even if primary.class is not FileOutput
end
write(chunk) click to toggle source
# File lib/fluent/plugin/out_file_with_fix_path.rb, line 31
def write(chunk)
  FileUtils.mkdir_p File.dirname(@path)
  File.open(@path, "a", DEFAULT_FILE_PERMISSION) do |f|
    chunk.write_to(f)
  end
end