Added request data logging in debug mode

This commit is contained in:
M1ha 2019-02-15 15:52:16 +05:00
parent e436ae977b
commit ab2fe24f74

View File

@ -1,3 +1,4 @@
import logging
from typing import Generator, Optional, Type, Iterable
from infi.clickhouse_orm.database import Database as InfiDatabase, DatabaseException
@ -9,6 +10,8 @@ from statsd.defaults.django import statsd
from .configuration import config
from .exceptions import DBAliasError
logger = logging.getLogger('django-clickhouse')
class Database(InfiDatabase):
def __init__(self, **kwargs):
@ -119,6 +122,7 @@ class Database(InfiDatabase):
# For testing purposes
for data in gen():
with statsd.timer(statsd_key):
logger.debug('django-clickhouse: insert tuple: %s' % data)
self._send(data)