From 70d0b985a9693542fbecab58c5c9d6f0a8a3f34b Mon Sep 17 00:00:00 2001 From: Konstantin Baierer Date: Thu, 4 Feb 2021 19:59:28 +0100 Subject: [PATCH] cli: add a --log-level option --- sbb_newspapers_org_image/cli.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sbb_newspapers_org_image/cli.py b/sbb_newspapers_org_image/cli.py index 75e148e..10bf5e8 100644 --- a/sbb_newspapers_org_image/cli.py +++ b/sbb_newspapers_org_image/cli.py @@ -1,5 +1,5 @@ import click -from ocrd_utils import initLogging +from ocrd_utils import initLogging, setOverrideLogLevel from sbb_newspapers_org_image.eynollah import eynollah @@ -84,6 +84,12 @@ from sbb_newspapers_org_image.eynollah import eynollah is_flag=True, help="if this parameter set to true, this tool would ignore headers role in reading order", ) +@click.option( + "--log-level", + "-l", + type=click.Choice(['OFF', 'DEBUG', 'INFO', 'WARN', 'ERROR']), + help="Override log level globally to this", +) def main( image, out, @@ -98,7 +104,10 @@ def main( full_layout, allow_scaling, headers_off, + log_level ): + if log_level: + setOverrideLogLevel(log_level) initLogging() eynollah( image,