From 3ab24bf3cda1b5dd5ebb03e6dd1f17490187727c Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Thu, 8 Feb 2024 20:00:58 -0500 Subject: [PATCH] FIX: Use consistent logger, set sensible default level, enable -q --- tools/schemacode/bidsschematools/__main__.py | 6 ++++-- tools/schemacode/bidsschematools/utils.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/schemacode/bidsschematools/__main__.py b/tools/schemacode/bidsschematools/__main__.py index e7796f3441..a7594a5379 100644 --- a/tools/schemacode/bidsschematools/__main__.py +++ b/tools/schemacode/bidsschematools/__main__.py @@ -13,9 +13,11 @@ @click.group() @click.option("-v", "--verbose", count=True) -def cli(verbose): +@click.option("-q", "--quiet", count=True) +def cli(verbose, quiet): """BIDS Schema Tools""" - logging.getLogger("bidsschematools").setLevel(logging.INFO - verbose * 10) + verbose = verbose - quiet + logging.getLogger("bidsschematools").setLevel(logging.WARNING - verbose * 10) @cli.command() diff --git a/tools/schemacode/bidsschematools/utils.py b/tools/schemacode/bidsschematools/utils.py index ec2947fb37..6f9850edb0 100644 --- a/tools/schemacode/bidsschematools/utils.py +++ b/tools/schemacode/bidsschematools/utils.py @@ -29,7 +29,7 @@ def get_logger(name=None): logging.Logger logger object. """ - return logging.getLogger("bids-schema" + (".%s" % name if name else "")) + return logging.getLogger("bidsschematools" + (".%s" % name if name else "")) def set_logger_level(lgr, level):