NAMESPACE: me.hegland-lance.examples.python.logging
PURPOSE: Example of Python logging with formats and file handlers across various modules and packages.
.
- Features
- Background
- Known Issues
- Requirements
- Installation
- Configuration
- Usage
- Contributors
- Roadmap
- License
.
Example of Python logging, including the following:
- single reusable and easily importable module for logging
- quick and easy to scan logging output
- contextual color symbols for log scanning
- different message formatting based on messaging level: FYI (e.g. debug, info) vs alert (e.g. warning, error, critical, exception)
- vital information for experimenting and debugging
- system environmental variables logged when execution initiated
- logger names indicate modules submitting messages
- alert messages include stack trace
- log file naming includes module and timestamp
- flexible
- options to output to file or stderr
- examples to build from
- sample log messages
- logging library use with loggers, handlers, formatters, and filters.
- argparse for command line interface help messaging
.
Lance created to help him learn how to incorporate Python logging across multiple modules plus quickly find vital information for experimenting and debugging.
.
None
.
- Familiarity and access to Python development tools, such as recent versions of the following:
Tool Download Reference with VSCode Python Link Link Link Git Link Link Link GitHub Link Link
.
- Review README.
- Satisfy minimum requirements.
- Get the repository.
- Create a local working directory (e.g.
D:\abc\...\xyz\python-logging\
) - From your local working directory
python-logging
, clone remote GitHub repositoryLHHegland/python_logging.git
(git clone git@github.com:LHHegland/python_logging.git
)
- Create a local working directory (e.g.
.
None
.
- Review README.md.
- Complete installation.
- Review sample log and code in modules, especially utils\logz.py, test.py, and a few pkg_x\mdl_x.py.
- Experiment with utils\logs.py
- Execute
py test.py
- Review
logs\test-[timestamp].log
- Execute
- Experiment with utils\logz.py
- Execute
py utils\logz.py --help
- Review on-screen results
- Execute
.
- Lance Hegland (lance.hegland@civic-innovations.com)
.
None
.
GNU General Public License v3.0 (GNU GPLv3)