Skip to content

Commit

Permalink
--no-warnings for even quieter output (errors only)
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c committed Dec 5, 2023
1 parent 0005383 commit e4b5d92
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions cwltool/argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ def arg_parser() -> argparse.ArgumentParser:

volumegroup = parser.add_mutually_exclusive_group()
volumegroup.add_argument("--verbose", action="store_true", help="Default logging")
volumegroup.add_argument("--no-warnings", action="store_true", help="Only print errors.")
volumegroup.add_argument("--quiet", action="store_true", help="Only print warnings and errors.")
volumegroup.add_argument("--debug", action="store_true", help="Print even more logging")

Expand Down
3 changes: 3 additions & 0 deletions cwltool/loghandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

def configure_logging(
stderr_handler: logging.Handler,
no_warnings: bool,
quiet: bool,
debug: bool,
enable_color: bool,
Expand All @@ -25,6 +26,8 @@ def configure_logging(
deps_logger.addHandler(stderr_handler)
ss_logger = logging.getLogger("salad")
ss_logger.addHandler(stderr_handler)
if no_warnings:
stderr_handler.setLevel(logging.ERROR)
if quiet:
# Silence STDERR, not an eventual provenance log file
stderr_handler.setLevel(logging.WARN)
Expand Down
1 change: 1 addition & 0 deletions cwltool/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,7 @@ def main(

configure_logging(
stderr_handler,
args.no_warnings,
args.quiet,
runtimeContext.debug,
args.enable_color,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_js_sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
("v7.7.3\n", True),
]

configure_logging(_logger.handlers[-1], False, True, True, True)
configure_logging(_logger.handlers[-1], False, False, True, True, True)
_logger.setLevel(logging.DEBUG)


Expand Down
2 changes: 1 addition & 1 deletion tests/test_load_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from .util import get_data

configure_logging(_logger.handlers[-1], False, True, True, True)
configure_logging(_logger.handlers[-1], False, False, True, True, True)
_logger.setLevel(logging.DEBUG)


Expand Down

0 comments on commit e4b5d92

Please sign in to comment.