Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Logging improvements for the pusher (#4691)
Browse files Browse the repository at this point in the history
  • Loading branch information
richvdh committed Feb 20, 2019
1 parent c88bc53 commit b2200a8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
1 change: 1 addition & 0 deletions changelog.d/4691.misc
@@ -0,0 +1 @@
Improve the logging in the pusher process.
16 changes: 8 additions & 8 deletions synapse/push/httppusher.py
Expand Up @@ -333,10 +333,10 @@ def dispatch_push(self, event, tweaks, badge):
defer.returnValue([])
try:
resp = yield self.http_client.post_json_get_json(self.url, notification_dict)
except Exception:
logger.warn(
"Failed to push event %s to %s",
event.event_id, self.name, exc_info=True,
except Exception as e:
logger.warning(
"Failed to push event %s to %s: %s %s",
event.event_id, self.name, type(e), e,
)
defer.returnValue(False)
rejected = []
Expand Down Expand Up @@ -367,10 +367,10 @@ def _send_badge(self, badge):
}
try:
resp = yield self.http_client.post_json_get_json(self.url, d)
except Exception:
logger.warn(
"Failed to send badge count to %s",
self.name, exc_info=True,
except Exception as e:
logger.warning(
"Failed to send badge count to %s: %s %s",
self.name, type(e), e,
)
defer.returnValue(False)
rejected = []
Expand Down
11 changes: 6 additions & 5 deletions synapse/push/pusher.py
Expand Up @@ -52,11 +52,12 @@ def __init__(self, hs):
logger.info("defined email pusher type")

def create_pusher(self, pusherdict):
logger.info("trying to create_pusher for %r", pusherdict)

if pusherdict['kind'] in self.pusher_types:
logger.info("found pusher")
return self.pusher_types[pusherdict['kind']](self.hs, pusherdict)
kind = pusherdict['kind']
f = self.pusher_types.get(kind, None)
if not f:
return None
logger.info("creating %s pusher for %r", kind, pusherdict)
return f(self.hs, pusherdict)

def _create_email_pusher(self, _hs, pusherdict):
app_name = self._app_name_from_pusherdict(pusherdict)
Expand Down

0 comments on commit b2200a8

Please sign in to comment.