Logging queries

All queries are logged to the peewee namespace using the standard library logging module. Queries are logged using the DEBUG level. If you’re interested in doing something with the queries, you can simply register a handler.

  1. # Print all queries to stderr.
  2. import logging
  3. logger = logging.getLogger('peewee')
  4. logger.addHandler(logging.StreamHandler())
  5. logger.setLevel(logging.DEBUG)