In this recipe, we will configure different debug levels, which 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 in the same module.
We will use four different logging levels and write our debugging output to a log file that we will create. If the logs 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_Refactored.py. We can also choose other names for our log files by passing in the full path to the initializer of our Logger class.