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

View File

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

View File

@ -1,6 +1,11 @@
module Mongo module Mongo
module Logging 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. # Log a message with the given level.
def log(level, msg) def log(level, msg)
return unless @logger return unless @logger

View File

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