Skip to content

Logging and Debugging

Walker Herring edited this page May 19, 2021 · 10 revisions

This project contains a small logging utility that is useful for debugging. It is defined in logger.py

To use it, first import it into your python file:

from logger import log, writelog, clearlog

To make a log:

log('MY_TAG', 'my debugging statement or info log')

To print all logs with the tag 'MY_TAG':

writelog('MY_TAG')

To clear the 'MY_TAG' logs:

clearlog('MY_TAG')

Open logger_config.cfg to edit the following settings:

  • enabled enables or disables the logger across the entire project. This allows you to disable it in a production environment to ensure it isn't slowing things down.
  • log_timestamps if true, prints the time the log was created along with the log
  • output determines where writelog writes logs to. Can be set to "console" for console output or a file name for file output.
Clone this wiki locally