From b5aa6c8561313522e77a730253111071835a64bd Mon Sep 17 00:00:00 2001 From: Diomidis Spinellis Date: Tue, 2 Jul 2024 18:55:20 +0300 Subject: [PATCH] Ensure --progress goes to stderr --- src/alexandria3k/__main__.py | 4 ++++ src/alexandria3k/debug.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/alexandria3k/__main__.py b/src/alexandria3k/__main__.py index 4bd53a0..a885ab3 100755 --- a/src/alexandria3k/__main__.py +++ b/src/alexandria3k/__main__.py @@ -530,6 +530,9 @@ def get_cli_parser(): type=str, default=[], # NOTE: Keep in sync with list in debug.py + # Exceptions: + # stderr does not work as a Debug API flag (use Debug.set_output) + # progress_bar is an undocumented CLI --debug option (use --progress) help="""Output debuggging information according to the comma-separated arguments. files-read: Counts of Crossref data files read; link: Record linking operations; @@ -591,6 +594,7 @@ def error_raising_main(): sys.exit(0) if args.progress: + debug.set_output(sys.stderr) debug.set_flags(["progress_bar"]) # Handle subcommands diff --git a/src/alexandria3k/debug.py b/src/alexandria3k/debug.py index c98ba17..9b10690 100644 --- a/src/alexandria3k/debug.py +++ b/src/alexandria3k/debug.py @@ -58,6 +58,9 @@ def get_output(): # NOTE: Keep in sync with list in __main__.py +# Exceptions: +# stderr does not work as a Debug API flag (use Debug.set_output) +# progress_bar is an undocumented CLI --debug option (use --progress) def set_flags(flags): """ Enable the specified debug flags. @@ -71,7 +74,6 @@ def set_flags(flags): * progress: Report population progress; * progress_bar: Display a progress bar; (enabled through --progress) * sorted-tables: Topologically ordered Crossref query tables; - * stderr: Log to standard error; :param flags: Flags to enable. :type flags: list