logging_util: support to tweak loglevel directed to stderr/stdout

Previously we set loglevel >= WARNING printed to stderr and
loglevel < WARNING printed to stdout. To be more flexible, we
replace this `WARNING` value with an argument: split_level and leave
`WARNING` as default split_level if not set.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
This commit is contained in:
Yanray Wang 2023-08-14 10:33:37 +08:00
parent ee07afa205
commit 1998aac349
2 changed files with 11 additions and 12 deletions

View file

@ -906,11 +906,8 @@ def main():
comp_args = parser.parse_args()
logger = logging.getLogger()
logging_util.configure_logger(logger)
if comp_args.stdout and not comp_args.verbose:
logger.setLevel(logging.ERROR)
else:
logger.setLevel(logging.DEBUG if comp_args.verbose else logging.INFO)
logging_util.configure_logger(logger, split_level=logging.NOTSET)
logger.setLevel(logging.DEBUG if comp_args.verbose else logging.INFO)
if os.path.isfile(comp_args.record_dir):
logger.error("record directory: {} is not a directory"