Skip to content

Commit

Permalink
Add feature #32 - debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
rudyryk committed Nov 30, 2016
1 parent fd55efe commit 738a83b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions peewee_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
import contextlib
import peewee
import warnings
import logging

logger = logging.getLogger('peewee.async')
logger.addHandler(logging.NullHandler())

try:
import aiopg
Expand Down Expand Up @@ -1466,6 +1470,8 @@ def __aexit__(self, exc_type, exc_val, exc_tb):
def _run_sql(database, operation, *args, **kwargs):
"""Run SQL operation (query or command) against database.
"""
logger.debug((operation, args, kwargs))

with database.exception_wrapper():
cursor = yield from database.cursor_async()

Expand Down

0 comments on commit 738a83b

Please sign in to comment.