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.

Files for arglog, version 2017.6.2
Filename, size File type Python version Upload date Hashes
Filename, size arglog-2017.6.2-py2.py3-none-any.whl (14.3 kB) File type Wheel Python version py2.py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page