diff options
author | Niranjan Paranjape <niranjan@c42.in> | 2012-06-09 12:18:39 +0530 |
---|---|---|
committer | Niranjan Paranjape <niranjan@c42.in> | 2012-06-09 12:23:18 +0530 |
commit | 01f8f29dc9420fa7ac5eff0e068dd639ef9d187a (patch) | |
tree | e9dd6d2851eddb7b0ef9b6c700b3eb0544aa6e3e | |
parent | 8475cddc986d9401f1d56c511f79032b5daed7c7 (diff) | |
download | rails-01f8f29dc9420fa7ac5eff0e068dd639ef9d187a.tar.gz rails-01f8f29dc9420fa7ac5eff0e068dd639ef9d187a.tar.bz2 rails-01f8f29dc9420fa7ac5eff0e068dd639ef9d187a.zip |
buffered logger is initialized with the log level passed trough the initializer
-rw-r--r-- | activesupport/lib/active_support/buffered_logger.rb | 4 | ||||
-rw-r--r-- | activesupport/test/buffered_logger_test.rb | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/buffered_logger.rb b/activesupport/lib/active_support/buffered_logger.rb index b1b539a2ec..85fb41f318 100644 --- a/activesupport/lib/active_support/buffered_logger.rb +++ b/activesupport/lib/active_support/buffered_logger.rb @@ -45,7 +45,6 @@ module ActiveSupport deprecate :auto_flushing def initialize(log, level = DEBUG) - @level = level @log_dest = log unless log.respond_to?(:write) @@ -58,6 +57,7 @@ Automatic directory creation for '#{log}' is deprecated. Please make sure the d end @log = open_logfile log + self.level = level end def open_log(log, mode) @@ -91,7 +91,7 @@ Automatic directory creation for '#{log}' is deprecated. Please make sure the d end # end def #{severity.downcase}? # def debug? - #{severity} >= level # DEBUG >= @level + #{severity} >= level # DEBUG >= level end # end EOT end diff --git a/activesupport/test/buffered_logger_test.rb b/activesupport/test/buffered_logger_test.rb index f975685ca5..ce677f8460 100644 --- a/activesupport/test/buffered_logger_test.rb +++ b/activesupport/test/buffered_logger_test.rb @@ -62,6 +62,11 @@ class BufferedLoggerTest < Test::Unit::TestCase File.unlink fname end + def test_should_default_logger_level_to_one_passed_while_creating_it + logger = Logger.new(@output, Logger::ERROR) + assert_equal Logger::ERROR, logger.level + end + def test_should_log_debugging_message_when_debugging @logger.level = Logger::DEBUG @logger.add(Logger::DEBUG, @message) |