Logging queries
All queries are logged to the peewee namespace using the standard librarylogging
module. Queries are logged using the DEBUG level. If you’reinterested in doing something with the queries, you can simply register ahandler.
- # Print all queries to stderr.
- import logging
- logger = logging.getLogger('peewee')
- logger.addHandler(logging.StreamHandler())
- logger.setLevel(logging.DEBUG)