Class: Fluent::Plugin::StdoutFormatter

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

Direct Known Subclasses

Compat::TextFormatter::StdoutFormatter

Constant Summary

Constants included from Configurable

Configurable::CONFIG_TYPE_REGISTRY

Instance Attribute Summary

Attributes inherited from Base

#under_plugin_development

Instance Method Summary collapse

Methods included from TimeMixin::Formatter

included, #time_formatter_create

Methods included from OwnedByMixin

#log, #owner, #owner=

Methods inherited from Base

#after_shutdown?, #after_start, #after_started?, #before_shutdown?, #closed?, #configured?, #has_router?, #initialize, #inspect, #shutdown?, #started?, #stopped?, #terminated?

Methods included from SystemConfig::Mixin

#system_config, #system_config_override

Methods included from Configurable

#config, included, #initialize, lookup_type, register_type

Constructor Details

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

Instance Method Details

#after_shutdownObject



58
59
60
61
# File 'lib/fluent/plugin/formatter_stdout.rb', line 58

def after_shutdown
  @sub_formatter.after_shutdown
  super
end

#before_shutdownObject



48
49
50
51
# File 'lib/fluent/plugin/formatter_stdout.rb', line 48

def before_shutdown
  @sub_formatter.before_shutdown
  super
end

#closeObject



63
64
65
66
# File 'lib/fluent/plugin/formatter_stdout.rb', line 63

def close
  @sub_formatter.close
  super
end

#configure(conf) ⇒ Object



26
27
28
29
30
31
# File 'lib/fluent/plugin/formatter_stdout.rb', line 26

def configure(conf)
  super

  @sub_formatter = Plugin.new_formatter(@output_type, parent: self.owner)
  @sub_formatter.configure(conf)
end

#format(tag, time, record) ⇒ Object



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

def format(tag, time, record)
  header = "#{Time.now.localtime} #{tag}: "
  "#{header}#{@sub_formatter.format(tag, time, record)}"
end

#shutdownObject



53
54
55
56
# File 'lib/fluent/plugin/formatter_stdout.rb', line 53

def shutdown
  @sub_formatter.shutdown
  super
end

#startObject



33
34
35
36
# File 'lib/fluent/plugin/formatter_stdout.rb', line 33

def start
  super
  @sub_formatter.start
end

#stopObject



43
44
45
46
# File 'lib/fluent/plugin/formatter_stdout.rb', line 43

def stop
  @sub_formatter.stop
  super
end

#terminateObject



68
69
70
71
# File 'lib/fluent/plugin/formatter_stdout.rb', line 68

def terminate
  @sub_formatter.terminate
  super
end