Class: Fluent::Plugin::OutFileFormatter

Inherits:
Formatter show all
Defined in:
lib/fluent/plugin/formatter_out_file.rb

Direct Known Subclasses

Compat::TextFormatter::OutFileFormatter

Constant Summary

Constants inherited from Formatter

Formatter::PARSER_TYPES

Constants included from Configurable

Configurable::CONFIG_TYPE_REGISTRY

Instance Attribute Summary

Attributes inherited from Base

#under_plugin_development

Instance Method Summary collapse

Methods inherited from Formatter

#formatter_type

Methods included from TimeMixin::Formatter

included, #time_formatter_create

Methods included from OwnedByMixin

#log, #owner, #owner=

Methods inherited from Base

#after_shutdown, #after_shutdown?, #after_start, #after_started?, #before_shutdown, #before_shutdown?, #close, #closed?, #configured?, #context_router, #context_router=, #fluentd_worker_id, #has_router?, #initialize, #inspect, #multi_workers_ready?, #plugin_root_dir, #shutdown, #shutdown?, #start, #started?, #stop, #stopped?, #string_safe_encoding, #terminate, #terminated?

Methods included from SystemConfig::Mixin

#system_config, #system_config_override

Methods included from Configurable

#config, #configure_proxy_generate, #configured_section_create, included, #initialize, lookup_type, register_type

Constructor Details

This class inherits a constructor from Fluent::Plugin::Base

Instance Method Details

#configure(conf) ⇒ Object



38
39
40
41
# File 'lib/fluent/plugin/formatter_out_file.rb', line 38

def configure(conf)
  super
  @timef = time_formatter_create
end

#format(tag, time, record) ⇒ Object



43
44
45
46
47
48
# File 'lib/fluent/plugin/formatter_out_file.rb', line 43

def format(tag, time, record)
  header = ''
  header << "#{@timef.format(time)}#{@delimiter}" if @output_time
  header << "#{tag}#{@delimiter}" if @output_tag
  "#{header}#{Yajl.dump(record)}\n"
end