Skip to content

Instantly share code, notes, and snippets.

@kdiverson
Created January 20, 2015 15:20
Show Gist options
  • Save kdiverson/299c4f9a9afce40241bd to your computer and use it in GitHub Desktop.
Save kdiverson/299c4f9a9afce40241bd to your computer and use it in GitHub Desktop.
import argparse
import logging
parser = argparse.ArgumentParser()
parser.add_argument('-d','--debug',
help='Print lots of debugging statements',
action="store_const",dest="loglevel",const=logging.DEBUG,
default=logging.WARNING
)
parser.add_argument('-v','--verbose',
help='Be verbose',
action="store_const",dest="loglevel",const=logging.INFO
)
args = parser.parse_args()
logging.basicConfig(level=args.loglevel)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment