Documentation and fixed a bug with the log
This commit is contained in:
parent
23214ff78f
commit
cfeb253cac
@ -57,7 +57,7 @@ def loadSettings(path: str | None) -> dict:
|
|||||||
|
|
||||||
def log(logline: str, path: str = './log.txt', stdout: bool = False) -> None:
|
def log(logline: str, path: str = './log.txt', stdout: bool = False) -> None:
|
||||||
'''
|
'''
|
||||||
Appends logline at the end of the file file with a timestamp
|
Appends `logline` at the end of the file file with a timestamp.
|
||||||
|
|
||||||
`logline` The line to log.
|
`logline` The line to log.
|
||||||
|
|
||||||
@ -130,8 +130,8 @@ def checkRecords(api: dict[str, dict[str, list[str]]], current_ip: str, log: Cal
|
|||||||
records_to_renew[key][domain] = list(set(records_to_renew[key][domain]) - set(record['rrset_name'] for record in (
|
records_to_renew[key][domain] = list(set(records_to_renew[key][domain]) - set(record['rrset_name'] for record in (
|
||||||
filter(lambda x: current_ip in x['rrset_values'], response.json()))))
|
filter(lambda x: current_ip in x['rrset_values'], response.json()))))
|
||||||
|
|
||||||
if records_to_renew[key][domain] != []:
|
if (records := records_to_renew[key][domain]) != []:
|
||||||
log(f"[INFO][{','.join(records_to_renew)}] Record need to be renewed")
|
log(f"[INFO][{','.join(records)}] Records need to be renewed")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
log(f"[ERROR][{domain}][{response.status_code}] {response.json()}")
|
log(f"[ERROR][{domain}][{response.status_code}] {response.json()}")
|
||||||
|
Loading…
Reference in New Issue
Block a user