class Fluent::Plugin::CsvFormatter

Public Instance Methods

configure(conf) click to toggle source
Calls superclass method Fluent::Plugin::Base#configure
# File lib/fluent/plugin/formatter_csv.rb, line 33
def configure(conf)
  super
  @fields = fields.select{|f| !f.empty? }
end
format(tag, time, record) click to toggle source
# File lib/fluent/plugin/formatter_csv.rb, line 38
def format(tag, time, record)
  row = @fields.map do |key|
    record[key]
  end
  CSV.generate_line(row, col_sep: @delimiter,
                    force_quotes: @force_quotes)
end