laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/pysim/+/37858?usp=email )


Change subject: contrib/saip-tool: Add command-line arguments to configure log 
level
......................................................................

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(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/58/37858/1

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 https://gerrit.osmocom.org/c/pysim/+/37858?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I4257d7b76193cdaad8c8571ff49f29067e8ab8c8
Gerrit-Change-Number: 37858
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <[email protected]>

Reply via email to