From: Dmitry Selyutin Date: Sat, 3 Jun 2023 15:15:42 +0000 (+0300) Subject: insndb/db: support log option X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4dd8f7d468d176899ed8641cafab22d58eac8688;p=openpower-isa.git insndb/db: support log option --- 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())