-
Notifications
You must be signed in to change notification settings - Fork 417
feature request: query logging #629
New issue
Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “No Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? No Sign in to your account
Comments
Not a bad idea. Patches are welcome. |
Are there any performance tests in the repo? |
Closed
Could you please have a look at changes while I'm fixing and writing new tests? |
@elprans |
It's possible to implement this oneself! import logging
from asyncpg.connection import Connection
class LoggingConnection(Connection):
_query_logger = logging.getLogger(__name__)
async def _execute(self, query, args, *posargs, **kwargs):
self._query_logger.info(
f"Executing query:\n" +
'\n'.join(' ' + line for line in query.splitlines()) +
f"...with args: {args}")
return await Connection._execute(self, query, args, *posargs, **kwargs) Now just pass ConnectionLogger as the |
Implemented in #1043. |
No Sign up for free
to join this conversation on GitHub.
Already have an account?
No Sign in to comment
I could not find any issue/question/pr related to this, so I'm starting a new one.
It would be great to have query logging implemented inside
asyncpg
:The text was updated successfully, but these errors were encountered: