When using the ruby mongo driver (2.0.6), you currently have to assign the logger and logger level on a Mongo singleton, like this:
Mongo::Logger.logger = other_logger
Mongo::Logger.logger.level = Logger::WARN
The Mongo singleton is problematic for us. Our application contains 3 isolated services, each with its own mongo database and logging system. We assumed the Mongo::Client would be an isolated class, and we could assign individual loggers, like in this contrived example...
mongo1 = Mongo::Client.new("mongodb://127.0.0.1:27017/db1")
mongo1.logger = some_logger1
mongo2 = Mongo::Client.new("mongodb://127.0.0.1:27017/db2")
mongo2.logger = some_logger2
mongo3 = Mongo::Client.new("mongodb://127.0.0.1:27017/db3")
mongo3.logger = some_logger3
... but it turns out we cannot.
Any chance the client can be refactored such that each client can have it's own logger assigned?