from pymongo import MongoClient

from mdstudio.db.impl.mongo_database_wrapper import MongoDatabaseWrapper
from mdstudio.logging.logger import Logger


class MongoClientWrapper(object):
    logger = Logger()

    def __init__(self, host, port):
        self._host = host
        self._port = port
        self._client = self.create_mongo_client(host, port)
        self._databases = {}

    def get_database(self, database_name):
        if database_name not in self._databases:
            if database_name not in self._client.database_names():
                self.logger.info('Creating database "{database}"', database=database_name)

            database = MongoDatabaseWrapper(database_name, self._client[database_name])
            self._databases[database_name] = database
        else:
            database = self._databases[database_name]

        return database

    def create_mongo_client(self, host, port):
        try:
            
            import mdstudio.unittest.db as db
            if db.create_mock_client:
                import mongomock
                return mongomock.MongoClient(host, port)
        except Exception:
            self.logger.warn('Unable to create Mongo mock client on: {0} {1}'.format(host, port))

        return MongoClient(host, port)

@@ -143,16 +143,35 @@
 Logger%0A%0A
+logger = Logger()%0A%0A
 %0Aclass M
@@ -200,30 +200,8 @@
 ct):
-%0A    logger = Logger()
 %0A%0A  
@@ -547,29 +547,24 @@
             
-self.
 logger.info(
@@ -858,16 +858,34 @@
 tabase%0A%0A
+    @staticmethod%0A
     def 
@@ -904,22 +904,16 @@
 _client(
-self, 
 host, po
@@ -1143,16 +1143,16 @@
 eption:%0A
+
         
@@ -1155,21 +1155,16 @@
         
-self.
 logger.w

Convert to staticmethod