Commit b60e4fb2 authored by Willi Rath's avatar Willi Rath

Add logger and verbosity flag

parent 25abfe3a
"""data_repo_renderer."""
import argparse
import logging
from pathlib import Path
from pkg_resources import get_distribution, DistributionNotFound
import shutil
......@@ -570,6 +571,8 @@ def cli_run_renderer(argvec=None):
"""Run renderer."""
# parse command line args
parser = argparse.ArgumentParser(description="Data repo renderer")
parser.add_argument("--verbose", action='store_true',
help="Print debugging output.")
parser.add_argument("--prefix", help=("Custom path to a directory that "
"will contain the rendered repo. "
"Defaults to: './rendered/'"))
......@@ -581,10 +584,21 @@ def cli_run_renderer(argvec=None):
args = parser.parse_args(argvec)
# extract arguments
verbose = (args.verbose is True)
util_src = Path(args.util if args.util is not None else "./util/")
prefix = Path(args.prefix if args.prefix is not None else "./rendered/")
yaml_file = Path(args.yaml_file)
# set up logging
logger = logging.getLogger("data_repo_renderer")
if verbose:
_log_level = logging.DEBUG
else:
_log_level = logging.INFO
logging.basicConfig(
level=_log_level,
format='%(asctime)s %(name)-16s: %(levelname)-8s %(message)s')
# load YAML file
with yaml_file.open() as stream:
yaml_dict = yaml.load(stream)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment