From cb813ba40208677f524aee0c565cb7a9652b7e72 Mon Sep 17 00:00:00 2001 From: DJ2LS Date: Tue, 8 Aug 2023 08:27:22 +0200 Subject: [PATCH] improved logging --- tnc/helpers.py | 3 ++- tnc/sock.py | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tnc/helpers.py b/tnc/helpers.py index 15d6bd0d..28acaf2b 100644 --- a/tnc/helpers.py +++ b/tnc/helpers.py @@ -497,7 +497,8 @@ def bool_to_string(state): def get_hmac_salt(dxcallsign: bytes, mycallsign: bytes): filename = f"freedata_hmac_STATION_{dxcallsign.decode('utf-8')}_REMOTE_{mycallsign.decode('utf-8')}.txt" - print(f"looking for file {filename}") + log.info("[SCK] [HMAC] File lookup", file=filename) + try: with open(filename, "r") as file: line = file.readlines() diff --git a/tnc/sock.py b/tnc/sock.py index 70f60e14..ef5218fb 100644 --- a/tnc/sock.py +++ b/tnc/sock.py @@ -782,11 +782,11 @@ class ThreadedTCPRequestHandler(socketserver.StreamRequestHandler): binarydata = base64.b64decode(base64data) # check if hmac hash is provided try: - print("looking for hmac salt...") + log.info("[SCK] [HMAC] Looking for salt/token", local=mycallsign, remote=dxcallsign) hmac_salt = helpers.get_hmac_salt(dxcallsign, mycallsign) - print(f" ... {hmac_salt}") + log.info("[SCK] [HMAC] Salt found", local=mycallsign, remote=dxcallsign, salt=hmac_salt) except Exception: - print("no hmac salt found...") + log.warning("[SCK] [HMAC] No salt/token found") hmac_salt = '' DATA_QUEUE_TRANSMIT.put( ["ARQ_RAW", binarydata, arq_uuid, mycallsign, dxcallsign, attempts, hmac_salt]