Permalink
Browse files

a bit more detailed logging time

  • Loading branch information...
1 parent 7fb1eb1 commit 7eac82b242f64248bed7087d57dd9e76fb511a79 @timoschilling timoschilling committed with brandonblack Nov 21, 2012
Showing with 2 additions and 2 deletions.
  1. +1 −1 lib/mongo/util/logging.rb
  2. +1 −1 test/functional/connection_test.rb
@@ -50,7 +50,7 @@ def self.instrumenter=(instrumenter)
def log_operation(name, payload, duration)
@logger && @logger.debug do
msg = "MONGODB "
- msg << "(#{(duration * 1000).to_i}ms) "
+ msg << "(%.1fms) " % (duration * 1000)
msg << "#{payload[:database]}['#{payload[:collection]}'].#{name}("
msg << payload.values_at(:selector, :document, :documents, :fields ).compact.map(&:inspect).join(', ') + ")"
msg << ".skip(#{payload[:skip]})" if payload[:skip]
@@ -198,7 +198,7 @@ def test_logging_duration
logger = Logger.new(output)
logger.level = Logger::DEBUG
standard_connection(:logger => logger).db(MONGO_TEST_DB)
- assert_match(/\(\d+ms\)/, output.string)
+ assert_match(/\(\d+.\d{1}ms\)/, output.string)
assert output.string.include?("admin['$cmd'].find")
end

0 comments on commit 7eac82b

Please sign in to comment.