Skip to content
Browse files

Treat strings as loggable

  • Loading branch information...
1 parent 1c62de0 commit fafc5e8810a8cd288b3d714af2fd5f6f551b924e @durran durran committed
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/mongo/loggable.rb
View
8 lib/mongo/loggable.rb
@@ -42,9 +42,15 @@ def log(level, prefix, operations)
ensure
runtime = ("%.4fms" % (1000 * (Time.now.to_f - started.to_f)))
operations.each do |operation|
- Logger.send(level, prefix, operation.log_message, runtime)
+ Logger.send(level, prefix, log_inspect(operation), runtime)
end
end
end
+
+ private
+
+ def log_inspect(operation)
+ operation.respond_to?(:log_message) ? operation.log_message : operation
+ end
end
end

0 comments on commit fafc5e8

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