diff --git a/config.ini.dist b/config.ini.dist index c5ffeb3..8e17036 100644 --- a/config.ini.dist +++ b/config.ini.dist @@ -5,6 +5,7 @@ api_key = 1234-ABCD-1234-A1B2 qrz_user = N0CALL qrz_pass = q1w2e3r4t5z6u7i8o9 xml_fields = ("call", "band", "mode", "qso_date", "time_on", "rst_sent", "rst_rcvd", "comment") +log_file = qrzlogger.log # default values for new QSOs band = 40m diff --git a/qrzlogger.py b/qrzlogger.py index 1cfa43b..e711205 100644 --- a/qrzlogger.py +++ b/qrzlogger.py @@ -65,6 +65,11 @@ headers["Content-Type"] = "application/x-www-form-urlencoded" session = None session_key = None +if config['qrzlogger']['log_file']: + log_file = config['qrzlogger']['log_file'] +else: + log_file = "qrzlogger.log" + # Read user definable colors from config if config['qrzlogger']['use_colors'] == "yes": inputcol = eval(config['qrzlogger']['inputcol']) @@ -328,6 +333,7 @@ def queryQSOData(qso): # QRZ.com logbook entry via the API def sendQSO(qso): logid = "null" + log_status = "FAILED: " # construct ADIF QSO entry adif = '' + config['qrzlogger']['station_call'] @@ -362,12 +368,16 @@ def sendQSO(qso): logid = "null" print(successcol) print("QSO successfully uploaded to QRZ.com (LOGID "+ logid + ")") + log_status = "SUCCESS: " print(style.RESET) + with open(log_file, "a") as log: + log.write(log_status + adif + "\n") return logid else: print(errorcol + "\nA critical error occured. Please review all previous output." + style.RESET) + # ask a user a simple y/n question # returns True if "y" # returns False in "n"