From 8b437adcde4acc1d309c81c707c264bcca05d394 Mon Sep 17 00:00:00 2001 From: Michele Dolfi <97102151+dolfim-ibm@users.noreply.github.com> Date: Wed, 13 Nov 2024 10:08:24 +0100 Subject: [PATCH] fix: reduce logging by keeping option for more verbose (#323) Signed-off-by: Michele Dolfi --- docling/cli/main.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/docling/cli/main.py b/docling/cli/main.py index 60a3c296..b79b7b9f 100644 --- a/docling/cli/main.py +++ b/docling/cli/main.py @@ -185,6 +185,15 @@ def convert( output: Annotated[ Path, typer.Option(..., help="Output directory where results are saved.") ] = Path("."), + verbose: Annotated[ + int, + typer.Option( + "--verbose", + "-v", + count=True, + help="Set the verbosity level. -v for info logging, -vv for debug logging.", + ), + ] = 0, version: Annotated[ Optional[bool], typer.Option( @@ -195,7 +204,12 @@ def convert( ), ] = None, ): - logging.basicConfig(level=logging.INFO) + if verbose == 0: + logging.basicConfig(level=logging.WARNING) + elif verbose == 1: + logging.basicConfig(level=logging.INFO) + elif verbose == 2: + logging.basicConfig(level=logging.DEBUG) if from_formats is None: from_formats = [e for e in InputFormat]