Skip to content
This repository
Browse code

Merge pull request #6688 from c42engineering/buffered_logger_level_wh…

…ile_creation

BufferedLogger level while creation
  • Loading branch information...
commit 35c89a48037391a10de0d12aa094c988a576d900 2 parents 5dfb01e + 01f8f29
Rafael Mendonça França rafaelfranca authored
4 activesupport/lib/active_support/buffered_logger.rb
@@ -45,7 +45,6 @@ def silence(temporary_level = ERROR)
45 45 deprecate :auto_flushing
46 46
47 47 def initialize(log, level = DEBUG)
48   - @level = level
49 48 @log_dest = log
50 49
51 50 unless log.respond_to?(:write)
@@ -58,6 +57,7 @@ def initialize(log, level = DEBUG)
58 57 end
59 58
60 59 @log = open_logfile log
  60 + self.level = level
61 61 end
62 62
63 63 def open_log(log, mode)
@@ -91,7 +91,7 @@ def #{severity.downcase}(message = nil, progname = nil, &block) # def debug(mess
91 91 end # end
92 92
93 93 def #{severity.downcase}? # def debug?
94   - #{severity} >= level # DEBUG >= @level
  94 + #{severity} >= level # DEBUG >= level
95 95 end # end
96 96 EOT
97 97 end
5 activesupport/test/buffered_logger_test.rb
@@ -62,6 +62,11 @@ def test_write_binary_data_create_file
62 62 File.unlink fname
63 63 end
64 64
  65 + def test_should_default_logger_level_to_one_passed_while_creating_it
  66 + logger = Logger.new(@output, Logger::ERROR)
  67 + assert_equal Logger::ERROR, logger.level
  68 + end
  69 +
65 70 def test_should_log_debugging_message_when_debugging
66 71 @logger.level = Logger::DEBUG
67 72 @logger.add(Logger::DEBUG, @message)

0 comments on commit 35c89a4

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