RUBY-345 update logging startup message

This commit is contained in:
Kyle Banker 2011-11-15 15:59:42 -05:00
parent fbadbe9977
commit 6345820eae
4 changed files with 8 additions and 5 deletions

View File

@ -608,8 +608,7 @@ module Mongo
@logger = opts[:logger] || nil
if @logger
@logger.debug("MongoDB logging. Please note that logging negatively impacts performance " +
"and should be disabled for high-performance production apps.")
write_logging_startup_message
end
should_connect = opts.fetch(:connect, true)

View File

@ -543,8 +543,7 @@ module Mongo
@cleanup_lock = Mutex.new
if @logger
@logger.debug("MongoDB logging. Please note that logging negatively impacts performance " +
"and should be disabled for high-performance production apps.")
write_logging_startup_message
end
should_connect = opts.fetch(:connect, true)

View File

@ -1,6 +1,11 @@
module Mongo
module Logging
def write_logging_startup_message
log(:warn, "Please note that logging negatively impacts client-side performance. " +
"You should set your logging level no lower than :info in production.")
end
# Log a message with the given level.
def log(level, msg)
return unless @logger

View File

@ -5,7 +5,7 @@ class CollectionTest < Test::Unit::TestCase
context "Basic operations: " do
setup do
@logger = mock()
@logger.expects(:debug)
@logger.expects(:warn)
end
should "send update message" do