kopia lustrzana https://github.com/ctjacobs/pyqso
Add logging statements for importing/exporting in ADIF format.
rodzic
6b7d42e6dd
commit
4f61570828
|
@ -196,7 +196,7 @@ class ADIF:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
""" Initialise class for I/O of files using the Amateur Data Interchange Format (ADIF). """
|
""" Initialise class for I/O of files using the Amateur Data Interchange Format (ADIF). """
|
||||||
logging.debug("New ADIF instance created!")
|
return
|
||||||
|
|
||||||
def read(self, path):
|
def read(self, path):
|
||||||
""" Read an ADIF file and parse it.
|
""" Read an ADIF file and parse it.
|
||||||
|
@ -224,6 +224,7 @@ class ADIF:
|
||||||
if(records == []):
|
if(records == []):
|
||||||
logging.warning("No records found in the file. Empty file or wrong file type?")
|
logging.warning("No records found in the file. Empty file or wrong file type?")
|
||||||
|
|
||||||
|
logging.info("Read %d QSOs from %s in ADIF format." % (len(records), path))
|
||||||
return records
|
return records
|
||||||
|
|
||||||
def parse_adi(self, text):
|
def parse_adi(self, text):
|
||||||
|
@ -362,14 +363,13 @@ class ADIF:
|
||||||
|
|
||||||
logging.debug("Finished writing records to the ADIF file.")
|
logging.debug("Finished writing records to the ADIF file.")
|
||||||
f.close()
|
f.close()
|
||||||
|
logging.info("Wrote %d QSOs to %s in ADIF format." % (len(records), path))
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
logging.error("I/O error %d: %s" % (e.errno, e.strerror))
|
logging.error("I/O error %d: %s" % (e.errno, e.strerror))
|
||||||
except Exception as e: # All other exceptions.
|
except Exception as e: # All other exceptions.
|
||||||
logging.error("An error occurred when writing the ADIF file.")
|
logging.error("An error occurred when writing the ADIF file.")
|
||||||
logging.exception(e)
|
logging.exception(e)
|
||||||
|
|
||||||
logging.info("Log exported to %s in ADIF format." % (path))
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def is_valid(self, field_name, data, data_type):
|
def is_valid(self, field_name, data, data_type):
|
||||||
|
|
Ładowanie…
Reference in New Issue