Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/fluent/command/fluentd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
op.on('-q', '--quiet', "decrease verbose level (-q: warn, -qq: error)", TrueClass) {|b|
return unless b
cur_level = cmd_opts.fetch(:log_level, default_opts[:log_level])
cmd_opts[:log_level] = [cur_level + 1, Fluent::Log::LEVEL_TRACE].max
cmd_opts[:log_level] = [cur_level + 1, Fluent::Log::LEVEL_ERROR].min
}

op.on('--suppress-config-dump', "suppress config dumping when fluentd starts", TrueClass) {|b|
Expand Down
13 changes: 9 additions & 4 deletions test/command/test_fluentd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,9 @@ def multi_workers_ready?; true; end
patterns_not_match: ["[trace]"])
end

test 'trace' do
data("Trace" => "-vv")
data("Invalid low level should be treated as Trace level": "-vvv")
test 'trace' do |option|
conf = <<CONF
<source>
@type sample
Expand All @@ -1194,7 +1196,7 @@ def multi_workers_ready?; true; end
CONF
conf_path = create_conf_file('sample.conf', conf)
assert File.exist?(conf_path)
assert_log_matches(create_cmdline(conf_path, "-vv"),
assert_log_matches(create_cmdline(conf_path, option),
"[trace]",)
end

Expand All @@ -1212,7 +1214,10 @@ def multi_workers_ready?; true; end
patterns_not_match: ["[info]"])
end

test 'error' do
data("Error" => "-qq")
data("Fatal should be treated as Error level" => "-qqq")
data("Invalid high level should be treated as Error level": "-qqqq")
test 'error' do |option|
conf = <<CONF
<source>
@type plugin_not_found
Expand All @@ -1221,7 +1226,7 @@ def multi_workers_ready?; true; end
CONF
conf_path = create_conf_file('plugin_not_found.conf', conf)
assert File.exist?(conf_path)
assert_log_matches(create_cmdline(conf_path, "-qq"),
assert_log_matches(create_cmdline(conf_path, option),
"[error]",
patterns_not_match: ["[warn]"])
end
Expand Down