Skip to main content

Arglog

Project description

https://img.shields.io/badge/stdlib--only-yes-green.svg https://travis-ci.org/cjrh/arglog.svg?branch=master https://coveralls.io/repos/github/cjrh/arglog/badge.svg?branch=master https://img.shields.io/pypi/pyversions/arglog.svg

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


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

arglog-2017.6.2-py2.py3-none-any.whl (14.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file arglog-2017.6.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for arglog-2017.6.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 02b1bc5faef9dc50b4d49125924d8e866c2dd8c135962f12480294419e50f856
MD5 88085f312d93f3d388d8149e5200487b
BLAKE2b-256 3278da132b403850a004db3a66736eec32b87ef6cad8648acce893f15d408603

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page