From b9bfeab7bada330e3d57d126c13e2102edcd14dc Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Sat, 3 Jun 2023 18:15:42 +0300 Subject: [PATCH] insndb/db: support log option --- src/openpower/insndb/db.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/openpower/insndb/db.py b/src/openpower/insndb/db.py index 1ddb578e..ed9063da 100644 --- a/src/openpower/insndb/db.py +++ b/src/openpower/insndb/db.py @@ -1,6 +1,6 @@ import argparse import contextlib -import sys +import os from openpower.decoder.power_enums import ( find_wiki_dir, @@ -59,7 +59,12 @@ def main(): "opcodes": OpcodesVisitor, "operands": OperandsVisitor, } + main_parser = argparse.ArgumentParser() + main_parser.add_argument("-l", "--log", + help="activate logging", + action="store_true", + default=False) main_subparser = main_parser.add_subparsers(dest="command", required=True) main_subparser.add_parser("list", help="list all instructions") @@ -73,6 +78,9 @@ def main(): args = vars(main_parser.parse_args()) command = args.pop("command") + log = args.pop("log") + if not log: + os.environ["SILENCELOG"] = "true" visitor = visitors[command](**args) db = Database(find_wiki_dir()) -- 2.30.2