diff --git a/src/f0cal/core/__main__.py b/src/f0cal/core/__main__.py index 40f9dc2..a00b536 100644 --- a/src/f0cal/core/__main__.py +++ b/src/f0cal/core/__main__.py @@ -11,6 +11,7 @@ def _top_level_args(parser): # # parser.add_argument('-f0o', '--f0cal-config-override', action='append') parser.add_argument("-j", "--json", action="store_true", help="Output in json format instead of human-readable") parser.add_argument("-c", "--core", default=f0cal.core.CORE) + parser.add_argument("-v", "--verbose", action="store_true", help="Print debugging output") def main(): f0cal.core.CORE.scanner.scan("f0cal") diff --git a/src/f0cal/core/helpers.py b/src/f0cal/core/helpers.py index 358896a..5a8f17a 100644 --- a/src/f0cal/core/helpers.py +++ b/src/f0cal/core/helpers.py @@ -1,3 +1,4 @@ +import logging import os import jinja2 as j2 @@ -28,3 +29,15 @@ def from_template_path(cls, template_path): dir_path, template_name = os.path.split(template_path) dir_path = os.path.abspath(dir_path) return cls(dir_path, template=template_name) + + +logging.basicConfig(format='%(levelname)s:%(asctime)s: %(message)s') +def create_client_log(name, verbose=False): + if verbose: + level = logging.DEBUG + else: + level = logging.WARNING + + logger = logging.getLogger(name) + logger.setLevel(level) + return logger