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.

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