Skip to content

Commit

Permalink
Optimize log printing
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles94jp committed Feb 6, 2022
1 parent 8e4ee28 commit 19aa782
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ddns.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,21 +155,22 @@ def update_domain_ip(self, new_ip):
+ '&rrid=' + self.rrid + '&rrhost=' + self.host + '&rrvalue=' + new_ip,
timeout=10)
r = r.text
r1 = r
r = r.split('<code>')[1]
r = r.split('</code>')[0]
if r == '300':
self.domainIp = new_ip
self.logger.info("update_domain_ip: \tupdate completed: " + self.domainIp)
self.lastUpdateDomainIpError = False
else:
self.logger.error("update_domain_ip: \tupdate failed")
self.logger.error("update_domain_ip: \tupdate failed. Namesilo response:\n" + r1)
if not self.lastUpdateDomainIpError:
self.send_new_ip(new_ip)
self.check_error()
self.lastUpdateDomainIpError = True
except Exception as e:
self.logger.exception(e)
self.logger.error("update_domain_ip: \tupdate failed")
self.logger.error("update_domain_ip: \tupdate error")
if not self.lastUpdateDomainIpError:
self.send_new_ip(new_ip)
self.check_error()
Expand Down

0 comments on commit 19aa782

Please sign in to comment.