diff --git a/cwltool/argparser.py b/cwltool/argparser.py index 5439d2bd2..50dd3a14f 100644 --- a/cwltool/argparser.py +++ b/cwltool/argparser.py @@ -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") diff --git a/cwltool/loghandler.py b/cwltool/loghandler.py index 0d613c820..76f0590e0 100644 --- a/cwltool/loghandler.py +++ b/cwltool/loghandler.py @@ -11,6 +11,7 @@ def configure_logging( stderr_handler: logging.Handler, + no_warnings: bool, quiet: bool, debug: bool, enable_color: bool, @@ -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) diff --git a/cwltool/main.py b/cwltool/main.py index 9c7343154..d71b1b8a1 100755 --- a/cwltool/main.py +++ b/cwltool/main.py @@ -1013,6 +1013,7 @@ def main( configure_logging( stderr_handler, + args.no_warnings, args.quiet, runtimeContext.debug, args.enable_color, diff --git a/tests/test_js_sandbox.py b/tests/test_js_sandbox.py index 9739c77a7..98b4cc115 100644 --- a/tests/test_js_sandbox.py +++ b/tests/test_js_sandbox.py @@ -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) diff --git a/tests/test_load_tool.py b/tests/test_load_tool.py index a74d64840..36bf6f31e 100644 --- a/tests/test_load_tool.py +++ b/tests/test_load_tool.py @@ -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)