Class: Fluent::SystemConfig
- Inherits:
-
Object
- Object
- Fluent::SystemConfig
show all
- Includes:
- Configurable
- Defined in:
- lib/fluent/system_config.rb
Defined Under Namespace
Modules: Mixin
Constant Summary
Configurable::CONFIG_TYPE_REGISTRY
Class Method Summary
collapse
Instance Method Summary
collapse
#config, #configure, included, lookup_type, register_type
Constructor Details
#initialize(conf = nil) ⇒ SystemConfig
Returns a new instance of SystemConfig.
63
64
65
66
67
|
# File 'lib/fluent/system_config.rb', line 63
def initialize(conf=nil)
super()
conf ||= SystemConfig.blank_system_config
configure(conf)
end
|
Class Method Details
.blank_system_config ⇒ Object
49
50
51
|
# File 'lib/fluent/system_config.rb', line 49
def self.blank_system_config
Fluent::Config::Element.new('<SYSTEM>', '', {}, [])
end
|
.create(conf) ⇒ Object
41
42
43
44
45
46
47
|
# File 'lib/fluent/system_config.rb', line 41
def self.create(conf)
systems = conf.elements(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
|
.overwrite_system_config(hash) ⇒ Object
53
54
55
56
57
58
59
60
61
|
# File 'lib/fluent/system_config.rb', line 53
def self.overwrite_system_config(hash)
older = defined?($_system_config) ? $_system_config : nil
begin
$_system_config = SystemConfig.new(Fluent::Config::Element.new('system', '', hash, []))
yield
ensure
$_system_config = older
end
end
|
Instance Method Details
#apply(supervisor) ⇒ Object
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
# File 'lib/fluent/system_config.rb', line 85
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?
@file_permission = system.file_permission unless system.file_permission.nil?
@dir_permission = system.dir_permission unless system.dir_permission.nil?
}
end
|
#dup ⇒ Object
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/fluent/system_config.rb', line 69
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.file_permission = @file_permission
s.dir_permission = @dir_permission
s
end
|