From 77147e5d011f85ba49b9d0cc0883cf7a4330aaf0 Mon Sep 17 00:00:00 2001 From: sinavir Date: Thu, 18 Apr 2024 17:35:28 +0200 Subject: [PATCH] fix: Add some more debug logs --- stateless_uptime_kuma/hydratation.py | 1 - stateless_uptime_kuma/uptime_kuma.py | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/stateless_uptime_kuma/hydratation.py b/stateless_uptime_kuma/hydratation.py index 8054fa0..569ead0 100644 --- a/stateless_uptime_kuma/hydratation.py +++ b/stateless_uptime_kuma/hydratation.py @@ -29,7 +29,6 @@ def hydrate_http_probes(tree, excludes=[]): headers = probe.kwargs.get("headers", None) body = probe.kwargs.get("body", None) content = requests.request(method, url, headers=headers, data=body).text - print(len(content)) m = re.search("(.*?)", content) if m is None: logger.info(f"Didn't find keywords for probe {probe.name}, skipping") diff --git a/stateless_uptime_kuma/uptime_kuma.py b/stateless_uptime_kuma/uptime_kuma.py index cb8a7da..0fefc4b 100644 --- a/stateless_uptime_kuma/uptime_kuma.py +++ b/stateless_uptime_kuma/uptime_kuma.py @@ -88,6 +88,7 @@ class Monitor(Item): def save(self): if self.saved: return + logger.debug(f"Saving {repr(self)}") for t, _ in self.tags: t.save() for n in self.notifications: @@ -113,6 +114,7 @@ class Monitor(Item): ) for t, v in self.tags: if (t, v) not in current_tags: + logger.debug(f"Adding tag: '{t}, {v}'") self.api.add_monitor_tag(tag_id=t.id, monitor_id=self.id, value=v) self.saved = True @@ -129,6 +131,7 @@ class Tag(Item): def save(self): if self.saved: return + logger.debug(f"Saving {repr(self)}") if self.id is None: rslt = self.api.add_tag( name=self.tag, @@ -143,6 +146,9 @@ class Tag(Item): ) self.saved = True + def __repr__(self): + return f"Tag({str(self)})" + class Notification(Item): def __init__(self, api, name, id=None, old_name=None, **kwargs): @@ -152,6 +158,7 @@ class Notification(Item): def save(self): if self.saved: return + logger.debug(f"Saving {repr(self)}") if self.id is None: rslt = self.api.add_notification( name=self.name, @@ -165,3 +172,6 @@ class Notification(Item): **self.kwargs, ) self.saved = True + + def __repr__(self): + return f"Notification({str(self)})"