mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Add a bit of logging
This commit is contained in:
parent
b87baaaa1d
commit
5d0c7fabf9
@ -1,4 +1,5 @@
|
|||||||
from importlib import import_module
|
from importlib import import_module
|
||||||
|
import logging
|
||||||
|
|
||||||
import bigchaindb
|
import bigchaindb
|
||||||
from bigchaindb.common.exceptions import ConfigurationError
|
from bigchaindb.common.exceptions import ConfigurationError
|
||||||
@ -9,6 +10,8 @@ BACKENDS = {
|
|||||||
'mongodb': 'bigchaindb.backend.mongodb.connection.MongoDBConnection',
|
'mongodb': 'bigchaindb.backend.mongodb.connection.MongoDBConnection',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def connect(backend=None, host=None, port=None, name=None):
|
def connect(backend=None, host=None, port=None, name=None):
|
||||||
"""Create a new connection to the database backend.
|
"""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:
|
except (ImportError, AttributeError) as exc:
|
||||||
raise ConfigurationError('Error loading backend `{}`'.format(backend)) from exc
|
raise ConfigurationError('Error loading backend `{}`'.format(backend)) from exc
|
||||||
|
|
||||||
|
logger.debug('Connection: {}'.format(Class))
|
||||||
return Class(host, port, dbname)
|
return Class(host, port, dbname)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
"""Database creation and schema-providing interfaces for backends."""
|
"""Database creation and schema-providing interfaces for backends."""
|
||||||
|
|
||||||
from functools import singledispatch
|
from functools import singledispatch
|
||||||
|
import logging
|
||||||
|
|
||||||
import bigchaindb
|
import bigchaindb
|
||||||
from bigchaindb.backend.connection import connect
|
from bigchaindb.backend.connection import connect
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@singledispatch
|
@singledispatch
|
||||||
def create_database(connection, dbname):
|
def create_database(connection, dbname):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user