Arglog
Project description
arglog
Add logging options to argparse automatically
Demo
# main.py
import argparse
import logging
import arglog
if __name__ == '__main__':
parser = argparse.ArgumentParser()
arglog.patch(parser)
args = parser.parse_args()
This will trigger the same effect as running:
logging.basicConfig(level='<level name>')
However, you now also have a new CLI option for your program:
$ python main.py --loglevel=WARNING
All of the logging levels are supported, INFO, DEBUG and so on.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file arglog-2017.6.2-py2.py3-none-any.whl
.
File metadata
- Download URL: arglog-2017.6.2-py2.py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02b1bc5faef9dc50b4d49125924d8e866c2dd8c135962f12480294419e50f856 |
|
MD5 | 88085f312d93f3d388d8149e5200487b |
|
BLAKE2b-256 | 3278da132b403850a004db3a66736eec32b87ef6cad8648acce893f15d408603 |