Configuring different debug output levels

In this recipe, we will configure different debug levels that we can select and change at runtime. This allows us to control how much we want to drill down into our code when debugging our code.

We will create two new Python classes and place both of them into the same module.

We will use four different logging levels and we will write our debugging output to a log file we will create. If the log folder does not exist, we will create it automatically as well.

The name of the log file is the name of the executing script which is our refactored GUI.py. We can also choose other names for our log files by passing in the full path to the initializer of our logger class.

Getting ready

We will continue to use our ...

Get Python GUI Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.