Skip to content
Snippets Groups Projects
Commit af663ca7 authored by Philipp Hörist's avatar Philipp Hörist
Browse files

MAM: Always include JID in logging messages

parent 8744bc0e
No related branches found
No related tags found
No related merge requests found
...@@ -264,7 +264,7 @@ def request_archive_on_signin(self): ...@@ -264,7 +264,7 @@ def request_archive_on_signin(self):
own_jid = self._con.get_own_jid().getBare() own_jid = self._con.get_own_jid().getBare()
if own_jid in self._mam_query_ids: if own_jid in self._mam_query_ids:
self._log.warning('MAM request for %s already running', own_jid) self._log.warning('Request already running: %s', own_jid)
return return
archive = app.logger.get_archive_infos(own_jid) archive = app.logger.get_archive_infos(own_jid)
...@@ -281,12 +281,14 @@ def request_archive_on_signin(self): ...@@ -281,12 +281,14 @@ def request_archive_on_signin(self):
start_date = None start_date = None
queryid = self._get_query_id(own_jid) queryid = self._get_query_id(own_jid)
if mam_id: if mam_id:
self._log.info('MAM query after: %s', mam_id) self._log.info('Request archive: %s, after mam-id %s',
own_jid, mam_id)
else: else:
# First Start, we request the last week # First Start, we request the last week
start_date = datetime.utcnow() - timedelta(days=7) start_date = datetime.utcnow() - timedelta(days=7)
self._log.info('First start: query archive start: %s', start_date) self._log.info('Request archive: %s, after date %s',
own_jid, start_date)
self._nbxmpp('MAM').make_query(own_jid, self._nbxmpp('MAM').make_query(own_jid,
queryid, queryid,
...@@ -310,14 +312,14 @@ def request_archive_on_muc_join(self, jid): ...@@ -310,14 +312,14 @@ def request_archive_on_muc_join(self, jid):
if archive is None or archive.last_mam_id is None: if archive is None or archive.last_mam_id is None:
# First join # First join
start_date = datetime.utcnow() - timedelta(days=1) start_date = datetime.utcnow() - timedelta(days=1)
self._log.info('First join: query archive %s from: %s', self._log.info('Request archive: %s, after date %s',
jid, start_date) jid, start_date)
elif threshold == SyncThreshold.NO_THRESHOLD: elif threshold == SyncThreshold.NO_THRESHOLD:
# Not our first join and no threshold set # Not our first join and no threshold set
mam_id = archive.last_mam_id mam_id = archive.last_mam_id
self._log.info('Request from archive: %s, after mam-id %s', self._log.info('Request archive: %s, after mam-id %s',
jid, archive.last_mam_id) jid, archive.last_mam_id)
else: else:
...@@ -325,7 +327,7 @@ def request_archive_on_muc_join(self, jid): ...@@ -325,7 +327,7 @@ def request_archive_on_muc_join(self, jid):
# last join and check against threshold # last join and check against threshold
last_timestamp = archive.last_muc_timestamp last_timestamp = archive.last_muc_timestamp
if last_timestamp is None: if last_timestamp is None:
self._log.info('No last muc timestamp found') self._log.info('No last muc timestamp found: %s', jid)
last_timestamp = 0 last_timestamp = 0
last = datetime.utcfromtimestamp(float(last_timestamp)) last = datetime.utcfromtimestamp(float(last_timestamp))
...@@ -333,13 +335,13 @@ def request_archive_on_muc_join(self, jid): ...@@ -333,13 +335,13 @@ def request_archive_on_muc_join(self, jid):
# To much time has elapsed since last join, apply threshold # To much time has elapsed since last join, apply threshold
start_date = datetime.utcnow() - timedelta(days=threshold) start_date = datetime.utcnow() - timedelta(days=threshold)
self._log.info('Too much time elapsed since last join, ' self._log.info('Too much time elapsed since last join, '
'request from: %s, threshold: %s', 'request archive: %s, after date %s, '
start_date, threshold) 'threshold: %s', jid, start_date, threshold)
else: else:
# Request from last mam-id # Request from last mam-id
mam_id = archive.last_mam_id mam_id = archive.last_mam_id
self._log.info('Request from archive %s after %s:', self._log.info('Request archive: %s, after mam-id %s:',
jid, archive.last_mam_id) jid, archive.last_mam_id)
if jid in self._catch_up_finished: if jid in self._catch_up_finished:
...@@ -370,7 +372,7 @@ def _result_finished(self, result, user_data): ...@@ -370,7 +372,7 @@ def _result_finished(self, result, user_data):
if result.complete: if result.complete:
self._catch_up_finished.append(result.jid) self._catch_up_finished.append(result.jid)
self._log.info('Catchup finished: %s, last mam id: %s', self._log.info('Request finished: %s, last mam id: %s',
result.jid, result.rsm.last) result.jid, result.rsm.last)
if result.rsm.last is not None: if result.rsm.last is not None:
...@@ -408,13 +410,14 @@ def request_archive_interval(self, ...@@ -408,13 +410,14 @@ def request_archive_interval(self,
after=None, after=None,
queryid=None): queryid=None):
jid = self._con.get_own_jid().getBare()
if after is None: if after is None:
self._log.info('Request interval from %s to %s', self._log.info('Request interval: %s, from %s to %s',
start_date, end_date) jid, start_date, end_date)
else: else:
self._log.info('Query page after %s', after) self._log.info('Request page: %s, after %s', jid, after)
jid = self._con.get_own_jid().getBare()
if queryid is None: if queryid is None:
queryid = self._get_query_id(jid) queryid = self._get_query_id(jid)
self._mam_query_ids[jid] = queryid self._mam_query_ids[jid] = queryid
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment