+#!/usr/bin/env python3
+# Usage: python3 ./bktemp-parseArgs -vv 3
+
+import argparse, logging;
+
+# Setup argument parser (see https://docs.python.org/3.7/library/argparse.html )
+parser = argparse.ArgumentParser(
+ description='Perform some work.',
+ epilog="Author: Steven Baltakatei Sandoval. License: GPLv3+");
+parser = argparse.ArgumentParser(
+ description='(example description) Delay activity for a random number of seconds. Delays sampled from an inverse gaussian distribution.',
+ epilog="(example epilog) Author: Steven Baltakatei Sandoval. License: GPLv3+");
+parser.add_argument('-v','--verbose',
+ action='count',
+ dest='verbosity',
+ default=0,
+ help='(example help) Verbose output. (repeat for increased verbosity)');
+parser.add_argument('mean',
+ action='store',
+ metavar='SECONDS',
+ nargs=1,
+ default=1,
+ type=float,
+ help='(example help) Mean seconds of delay. Is the mean of the inverse gaussian distribution.');
+args = parser.parse_args();
+
+# Define functions
+def setup_logging(verbosity):
+ # Depends: module: argparse
+ # Ref/Attrib: Haas, Florian; Configure logging with argparse; https://xahteiwi.eu/resources/hints-and-kinks/python-cli-logging-options/
+ base_loglevel = 30;
+ verbosity = min(verbosity, 2);
+ loglevel = base_loglevel - (verbosity * 10);
+ logging.basicConfig(level=loglevel,
+ format='%(message)s');
+
+## Start up logger
+setup_logging(args.verbosity);
+logging.debug('DEBUG:Debug logging output enabled.');
+logging.debug('DEBUG:args.verbosity:' + str(args.verbosity));
+logging.debug('DEBUG:args:' + str(args));