From 63fcb7d3b27905d1e03ec0a5a7f80bae64696099 Mon Sep 17 00:00:00 2001 From: jc00ke Date: Wed, 14 Mar 2012 10:09:46 -0700 Subject: [PATCH] Explicitly set logger level. Fixes #79 be1ef57 removed set_logger_level_to_debug but neglected to make the change in parse_options for the -v flag. --- lib/sidekiq/cli.rb | 2 +- test/test_cli.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/sidekiq/cli.rb b/lib/sidekiq/cli.rb index 578cecf8..47bc6c3c 100644 --- a/lib/sidekiq/cli.rb +++ b/lib/sidekiq/cli.rb @@ -115,7 +115,7 @@ module Sidekiq end o.on "-v", "--verbose", "Print more verbose output" do - set_logger_level_to_debug + Sidekiq::Util.logger.level = Logger::DEBUG end o.on '-e', '--environment ENV', "Application environment" do |arg| diff --git a/test/test_cli.rb b/test/test_cli.rb index b2cdf31e..192cea5a 100644 --- a/test/test_cli.rb +++ b/test/test_cli.rb @@ -50,6 +50,14 @@ class TestCli < MiniTest::Unit::TestCase assert_equal %w(bar foo foo foo), Sidekiq.options[:queues].sort end + it 'sets verbose' do + old = Sidekiq::Util.logger.level + @cli.parse(['sidekiq', '-v', '-r', './test/fake_env.rb']) + assert_equal Logger::DEBUG, Sidekiq::Util.logger.level + # If we leave the logger at DEBUG it'll add a lot of noise to the test output + Sidekiq::Util.logger.level = old + end + describe 'with pidfile' do before do @tmp_file = Tempfile.new('sidekiq-test')