Clean up output

We're printing "No tag read" many, many, MANY times each second to the
log.  Let's cut back a bit to make debugging easier.

We should also print when we're clearing the cache in case we need to
find that in the logs later.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
Anna Schumaker 2016-01-19 13:30:19 -05:00
parent b9eadf9112
commit 27d8399529
1 changed files with 2 additions and 3 deletions

View File

@ -120,6 +120,7 @@ def clear_cache():
today = datetime.date.today()
if today.month != THIS_MONTH:
print("Clearing key cache")
CACHED_KEYS.clear()
THIS_MONTH = today.month
@ -158,9 +159,7 @@ RFID_SERIAL = serial.Serial(RFID_PATH, 2400, timeout=1)
def _do_read_rfid():
string = RFID_SERIAL.read(12)
if len(string) == 0:
print("No tag read")
else:
if len(string) > 0:
key = string[1:11].decode() #exclude start x0A and stop x0D bytes
print("Read key: %s" % key)
verify_key(key)