Some examples of logging in Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
.gitignore
README.md
logger_cfg_example.cfg
logger_cfg_example.log
logger_cfg_example.log.1
logger_cfg_example.log.2
logger_cfg_example.log.3
logger_cfg_example.py
logger_example.log
logger_example.py
loguru_example.py

README.md

Overview

This project explores some of the Python logging features compliments of the logging API.

logger_example.py

This script shows how I normally use the API: I normally code my configuration right into the script. I prefer not to do that, however. Ideally, I'd like to be able to move my logging configuration to a properties file and role my logs, among other improvements.

logger_cfg_example.py

This script shows how I can achieve some of those improvements. It uses the logger_cfg_example.cfg file for the logging configuration and it turns out Python does in fact offer a rotating file handler.

Future Considerations

Despite the nice offerings of the logging API, people have still authored other packages like logzero and loguru. Some day, I'd like to spend time looking at those packages to see what they can offer above and beyond the standard logging package.