Feat: add option for debugging

This commit is contained in:
Bertrand Benjamin 2023-12-30 17:25:40 +01:00
parent b15b059e2a
commit 7bf0c38883

View File

@ -7,6 +7,14 @@ import click
from .extract import extract_save from .extract import extract_save
from .join import join_excel from .join import join_excel
@click.group()
@click.option("--debug/--no-debug", default=False)
def main(debug):
if debug:
logging_level = logging.DEBUG
else:
logging_level = logging.INFO
logging_config = dict( logging_config = dict(
version=1, version=1,
formatters={"f": {"format": "%(levelname)-8s %(name)-12s %(message)s"}}, formatters={"f": {"format": "%(levelname)-8s %(name)-12s %(message)s"}},
@ -14,23 +22,18 @@ logging_config = dict(
"h": { "h": {
"class": "logging.StreamHandler", "class": "logging.StreamHandler",
"formatter": "f", "formatter": "f",
"level": logging.DEBUG, "level": logging_level,
} }
}, },
root={ root={
"handlers": ["h"], "handlers": ["h"],
"level": logging.DEBUG, "level": logging_level,
}, },
) )
dictConfig(logging_config) dictConfig(logging_config)
@click.group()
def main():
pass
@main.group() @main.group()
def extract(): def extract():
pass pass