Add a bit of logging

This commit is contained in:
Sylvain Bellemare 2016-12-13 11:48:34 +01:00
parent b87baaaa1d
commit 5d0c7fabf9
2 changed files with 7 additions and 0 deletions

View File

@ -1,4 +1,5 @@
from importlib import import_module
import logging
import bigchaindb
from bigchaindb.common.exceptions import ConfigurationError
@ -9,6 +10,8 @@ BACKENDS = {
'mongodb': 'bigchaindb.backend.mongodb.connection.MongoDBConnection',
}
logger = logging.getLogger(__name__)
def connect(backend=None, host=None, port=None, name=None):
"""Create a new connection to the database backend.
@ -45,6 +48,7 @@ def connect(backend=None, host=None, port=None, name=None):
except (ImportError, AttributeError) as exc:
raise ConfigurationError('Error loading backend `{}`'.format(backend)) from exc
logger.debug('Connection: {}'.format(Class))
return Class(host, port, dbname)

View File

@ -1,10 +1,13 @@
"""Database creation and schema-providing interfaces for backends."""
from functools import singledispatch
import logging
import bigchaindb
from bigchaindb.backend.connection import connect
logger = logging.getLogger(__name__)
@singledispatch
def create_database(connection, dbname):