laforge submitted this change.
contrib/saip-tool: Add command-line arguments to configure log level
Change-Id: I4257d7b76193cdaad8c8571ff49f29067e8ab8c8
---
M contrib/saip-tool.py
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/contrib/saip-tool.py b/contrib/saip-tool.py
index 22b913e..7b57488 100755
--- a/contrib/saip-tool.py
+++ b/contrib/saip-tool.py
@@ -31,11 +31,12 @@
pp = HexBytesPrettyPrinter(indent=4,width=500)
-logging.basicConfig(level=logging.INFO)
-
parser = argparse.ArgumentParser(description="""
Utility program to work with eSIM SAIP (SimAlliance Interoperable Profile) files.""")
parser.add_argument('INPUT_UPP', help='Unprotected Profile Package Input file')
+parser.add_argument("--loglevel", dest="loglevel", choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'],
+ default='INFO', help="Set the logging level")
+parser.add_argument('--debug', action='store_true', help='Enable DEBUG logging')
subparsers = parser.add_subparsers(dest='command', help="The command to perform", required=True)
parser_split = subparsers.add_parser('split', help='Split PE-Sequence into individual PEs')
@@ -225,6 +226,11 @@
if __name__ == '__main__':
opts = parser.parse_args()
+ if opts.debug:
+ logging.basicConfig(level=logging.DEBUG)
+ else:
+ logging.basicConfig(level=logging.getLevelName(opts.loglevel))
+
with open(opts.INPUT_UPP, 'rb') as f:
pes = ProfileElementSequence.from_der(f.read())
To view, visit change 37858. To unsubscribe, or for help writing mail filters, visit settings.