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 Aug 16, 2023
1 parent 5a645df commit 297cd74
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 @@ -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)

Check warning on line 26 in cwltool/loghandler.py

View check run for this annotation

Codecov / codecov/patch

cwltool/loghandler.py#L26

Added line #L26 was not covered by tests
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 @@ -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)


Expand Down

0 comments on commit 297cd74

Please sign in to comment.