1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

Allow to set logger level in initialization

This commit is contained in:
MasterLambaster 2012-06-06 13:27:46 +03:00
parent e82de1c6be
commit fc899aa83f
2 changed files with 12 additions and 2 deletions

View file

@ -7,7 +7,7 @@ module Capistrano
INFO = 1
DEBUG = 2
TRACE = 3
MAX_LEVEL = 3
def initialize(options={})
@ -20,7 +20,7 @@ module Capistrano
end
@options = options
@level = 0
@level = options[:level] || 0
end
def close

View file

@ -13,6 +13,16 @@ class LoggerTest < Test::Unit::TestCase
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