Class: Fluent::SystemConfig

Inherits:
Object
  • Object
show all
Includes:
Configurable
Defined in:
lib/fluent/system_config.rb

Constant Summary

Constants included from Configurable

Configurable::CONFIG_TYPE_REGISTRY

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Configurable

#config, #configure, included, lookup_type, register_type

Constructor Details

#initialize(conf = nil) ⇒ SystemConfig

Returns a new instance of SystemConfig.



64
65
66
67
68
# File 'lib/fluent/system_config.rb', line 64

def initialize(conf=nil)
  super()
  conf ||= SystemConfig.blank_system_config
  configure(conf)
end

Class Method Details

.blank_system_configObject



60
61
62
# File 'lib/fluent/system_config.rb', line 60

def self.blank_system_config
  Fluent::Config::Element.new('<SYSTEM>', '', {}, [])
end

.create(conf) ⇒ Object



50
51
52
53
54
55
56
57
58
# File 'lib/fluent/system_config.rb', line 50

def self.create(conf)
  systems = conf.elements.select { |e|
    e.name == 'system'
  }
  return SystemConfig.new if systems.empty?
  raise Fluent::ConfigError, "<system> is duplicated. <system> should be only one" if systems.size > 1

  SystemConfig.new(systems.first)
end

Instance Method Details

#apply(supervisor) ⇒ Object



84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/fluent/system_config.rb', line 84

def apply(supervisor)
  system = self
  supervisor.instance_eval {
    @log.level = @log_level = system.log_level unless system.log_level.nil?
    @suppress_interval = system.emit_error_log_interval unless system.emit_error_log_interval.nil?
    @suppress_config_dump = system.suppress_config_dump unless system.suppress_config_dump.nil?
    @suppress_repeated_stacktrace = system.suppress_repeated_stacktrace unless system.suppress_repeated_stacktrace.nil?
    @without_source = system.without_source unless system.without_source.nil?
    @rpc_endpoint = system.rpc_endpoint unless system.rpc_endpoint.nil?
    @enable_get_dump = system.enable_get_dump unless system.enable_get_dump.nil?
    @process_name = system.process_name unless system.process_name.nil?
  }
end

#dupObject



70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/fluent/system_config.rb', line 70

def dup
  s = SystemConfig.new
  s.log_level = @log_level
  s.suppress_repeated_stacktrace = @suppress_repeated_stacktrace
  s.emit_error_log_interval = @emit_error_log_interval
  s.suppress_config_dump = @suppress_config_dump
  s.without_source = @without_source
  s.rpc_endpoint = @rpc_endpoint
  s.enable_get_dump = @enable_get_dump
  s.process_name = @process_name

  s
end