Skip to content
Browse files

Allow to set logger level in initialization

  • Loading branch information...
1 parent e82de1c commit fc899aa83f2323c00daad5bbc93c5c16eda0d400 @MasterLambaster MasterLambaster committed
Showing with 12 additions and 2 deletions.
  1. +2 −2 lib/capistrano/logger.rb
  2. +10 −0 test/logger_test.rb
View
4 lib/capistrano/logger.rb
@@ -7,7 +7,7 @@ class Logger #:nodoc:
INFO = 1
DEBUG = 2
TRACE = 3
-
+
MAX_LEVEL = 3
def initialize(options={})
@@ -20,7 +20,7 @@ def initialize(options={})
end
@options = options
- @level = 0
+ @level = options[:level] || 0
end
def close
View
10 test/logger_test.rb
@@ -13,6 +13,16 @@ def test_logger_should_use_STDERR_by_default
assert_equal STDERR, logger.device
end
+ def test_logger_should_have_log_level_0
+ logger = Capistrano::Logger.new
+ assert_equal 0, logger.level
+ end
+
+ def test_logger_should_use_level_form_options
+ logger = Capistrano::Logger.new :level => 4
+ assert_equal 4, logger.level
+ end
+
def test_logger_should_use_output_option_if_output_responds_to_puts
logger = Capistrano::Logger.new(:output => STDOUT)
assert_equal STDOUT, logger.device

0 comments on commit fc899aa

Please sign in to comment.
Something went wrong with that request. Please try again.