3.5 Extras
Here are some ideas for you to add to this project.
3.5.1 Logging enhancements
We skimmed over logging, suggesting only that it’s important and that the initialization for logging should be kept separate from the processing within the main()
function.
The logging
module has a great deal of sophistication, however, and it can help to explore this. We’ll start with logging ”levels”.
Many of our logging messages will be created with the INFO
level of logging. For example:
logger.info("%d rows processed", input_count)
This application has a number of possible error situations that are best reflected with error-level logging.
Additionally, there is a tree of named loggers. The root logger, named ""
, has settings that apply to all the lower-level loggers. This tree tends to parallel the way object inheritance is often used to create classes and subclasses. This can make it advantageous to create loggers for each class...