diff --git a/cwltool/argparser.py b/cwltool/argparser.py index 332f18d86..90629d5a1 100644 --- a/cwltool/argparser.py +++ b/cwltool/argparser.py @@ -385,6 +385,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/cwlprov/ro.py b/cwltool/cwlprov/ro.py index f2bb9cf74..87c060cdc 100644 --- a/cwltool/cwlprov/ro.py +++ b/cwltool/cwlprov/ro.py @@ -5,7 +5,6 @@ import os import shutil import tempfile -import traceback import uuid from pathlib import Path, PurePosixPath from typing import ( diff --git a/cwltool/loghandler.py b/cwltool/loghandler.py index c1f451991..7ef71206c 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, @@ -21,6 +22,8 @@ def configure_logging( rdflib_logger = logging.getLogger("rdflib.term") rdflib_logger.addHandler(stderr_handler) rdflib_logger.setLevel(logging.ERROR) + 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 2ae9f9f6a..4d536a679 100755 --- a/cwltool/main.py +++ b/cwltool/main.py @@ -8,7 +8,6 @@ import io import logging import os -import shutil import signal import subprocess # nosec import sys 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 3d0cba161..f291d2985 100644 --- a/tests/test_load_tool.py +++ b/tests/test_load_tool.py @@ -15,7 +15,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)