laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/pysim/+/42738?usp=email )

Change subject: pySim/app: use pySimLogger instead of print
......................................................................

pySim/app: use pySimLogger instead of print

let's replace the stray print statements with proper logger calls.

Related: SYS#6959
Change-Id: I95b4536cc8853e7ba6a5dd573b903dfb85e56b9a
---
M pySim/app.py
1 file changed, 7 insertions(+), 4 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved




diff --git a/pySim/app.py b/pySim/app.py
index 23a4c3c..4e88788 100644
--- a/pySim/app.py
+++ b/pySim/app.py
@@ -26,6 +26,9 @@
 from pySim.ts_102_221 import CardProfileUICC
 from pySim.utils import all_subclasses
 from pySim.exceptions import SwMatchError
+from pySim.log import PySimLogger
+
+log = PySimLogger.get(__name__)

 # we need to import this module so that the SysmocomSJA2 sub-class of
 # CardModel is created, which will add the ATR-based matching and
@@ -54,7 +57,7 @@

     # Wait up to three seconds for a card in reader and try to detect
     # the card type.
-    print("Waiting for card...")
+    log.info("Waiting for card...")
     sl.wait_for_card(3)

     # The user may opt to skip all card initialization. In this case only the
@@ -66,7 +69,7 @@
     generic_card = False
     card = card_detect(scc)
     if card is None:
-        print("Warning: Could not detect card type - assuming a generic card 
type...")
+        log.warning("Could not detect card type - assuming a generic card 
type...")
         card = SimCardBase(scc)
         generic_card = True

@@ -76,7 +79,7 @@
         # just means that pySim was unable to recognize the card profile. This
         # may happen in particular with unprovisioned cards that do not have
         # any files on them yet.
-        print("Unsupported card type!")
+        log.warning("Unsupported card type!")
         return None, card

     # ETSI TS 102 221, Table 9.3 specifies a default for the PIN key
@@ -87,7 +90,7 @@
     if generic_card and isinstance(profile, CardProfileUICC):
         card._adm_chv_num = 0x0A

-    print("Info: Card is of type: %s" % str(profile))
+    log.info("Card is of type: %s", str(profile))

     # FIXME: this shouldn't really be here but somewhere else/more generic.
     # We cannot do it within pySim/profile.py as that would create circular

--
To view, visit https://gerrit.osmocom.org/c/pysim/+/42738?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I95b4536cc8853e7ba6a5dd573b903dfb85e56b9a
Gerrit-Change-Number: 42738
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>

Reply via email to