New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

argparse-logging

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

argparse-logging

This is a simple library to configure logging from command line argument when using argparse.

  • 2020.11.26
  • PyPI
  • Socket score

Maintainers
1

Argparse_logging

This is a simple library to configure logging from command line argument when using argparse.

Without argparse_logging:

from argparse import ArgumentParser

parser = ArgumentParser()
parser.add_argument(
    "--log-level",
    default=logging.INFO,
    type=lambda x: getattr(logging, x)),
    help="Configure the logging level.",
)
args = parser.parse_args()
logging.basicConfig(level=args.log_level)

This is a bit annoying to copy paste in every program.

Instead you can use argparse_logging to get the following:

from argparse import ArgumentParser
from argparse_logging import add_log_level_argument

parser = ArgumentParser()
add_log_level_argument(parser)
args = parser.parse_args()

Deployment

You will need git, pipenv, python, pre-commit. Then you can set up your virtual environment:

$ git clone git@github.com:nanassito/argparse_logging.git
$ cd argparse_logging
$ pipenv update --dev

Do whatever changes you want. You can run the tests and linting with:

$ pipenv run py.test
$ pre-commit

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc