Skip to content

Commit

Permalink
unify the condition
Browse files Browse the repository at this point in the history
Signed-off-by: Yuta Iwama <[email protected]>
  • Loading branch information
ganmacs committed Oct 31, 2019
1 parent a1d6f36 commit 1089d34
Showing 1 changed file with 19 additions and 30 deletions.
49 changes: 19 additions & 30 deletions lib/fluent/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,38 +79,27 @@ def parse_config(io, fname, basepath = Dir.pwd, v1_config = false)

def run_configure(conf)
configure(conf)
conf.check_not_fetched { |key, e|
conf.check_not_fetched do |key, e|
parent_name, plugin_name = e.unused_in
if parent_name
message = if plugin_name
"section <#{e.name}> is not used in <#{parent_name}> of #{plugin_name} plugin"
else
"section <#{e.name}> is not used in <#{parent_name}>"
end

if @dry_run_mode && @supervisor_mode
$log.warn :supervisor, message
elsif e.for_every_workers?
$log.warn :worker0, message
elsif e.for_this_worker?
$log.warn message
end
next
message = if parent_name && plugin_name
"section <#{e.name}> is not used in <#{parent_name}> of #{plugin_name} plugin"
elsif parent_name
"section <#{e.name}> is not used in <#{parent_name}>"
elsif e.name != 'system' && !(@without_source && e.name == 'source')
"parameter '#{key}' in #{e.to_s.strip} is not used."
else
nil
end
next if message.nil?

if @dry_run_mode && @supervisor_mode
$log.warn :supervisor, message
elsif e.for_every_workers?
$log.warn :worker0, message
elsif e.for_this_worker?
$log.warn message
end

unless e.name == 'system'
unless @without_source && e.name == 'source'
message = "parameter '#{key}' in #{e.to_s.strip} is not used."
if @dry_run_mode && @supervisor_mode
$log.warn :supervisor, message
elsif e.for_every_workers?
$log.warn :worker0, message
elsif e.for_this_worker?
$log.warn message
end
end
end
}
end
end

def configure(conf)
Expand Down

0 comments on commit 1089d34

Please sign in to comment.