From 7fd29055b61e0e201f1806c8d19dab6a4ce53bdf Mon Sep 17 00:00:00 2001 From: drebs Date: Mon, 10 Oct 2016 10:40:54 -0300 Subject: [bug] fix error logging calls using twisted logger --- src/leap/bitmask/bonafide/config.py | 4 ++-- src/leap/bitmask/core/mail_services.py | 6 +++--- src/leap/bitmask/mail/adaptors/soledad.py | 2 +- src/leap/bitmask/mail/imap/mailbox.py | 18 +++++++++--------- 4 files changed, 15 insertions(+), 15 deletions(-) (limited to 'src/leap') diff --git a/src/leap/bitmask/bonafide/config.py b/src/leap/bitmask/bonafide/config.py index bf16d30..441f6a4 100644 --- a/src/leap/bitmask/bonafide/config.py +++ b/src/leap/bitmask/bonafide/config.py @@ -343,7 +343,7 @@ class Provider(object): # See: # https://leap.se/code/issues/7906 def further_bootstrap_needs_auth(ignored): - logger.warning('cannot download services config yet, need auth') + logger.warn('cannot download services config yet, need auth') pending_deferred = defer.Deferred() self.stuck_bootstrap[self._domain] = pending_deferred return pending_deferred @@ -396,7 +396,7 @@ class Provider(object): if stuck: d = self._get_config_for_all_services(session) d.addCallback(lambda _: stuck.callback('continue!')) - d.addErrback(logger.err) + d.addErrback(logger.error) return d if not self.has_fetched_services_config(): diff --git a/src/leap/bitmask/core/mail_services.py b/src/leap/bitmask/core/mail_services.py index 14f6e0f..c5a6636 100644 --- a/src/leap/bitmask/core/mail_services.py +++ b/src/leap/bitmask/core/mail_services.py @@ -286,8 +286,8 @@ class KeymanagerContainer(Container): def _log_key_error(step): def log_error(failure): - logger.err("Error while %s key!" % step) - logger.err(failure) + logger.error("Error while %s key!" % step) + logger.error(failure) return failure return log_error @@ -702,7 +702,7 @@ class IncomingMailService(service.MultiService): d = acc.callWhenReady( lambda _: acc.get_collection_by_mailbox(INBOX_NAME)) d.addCallback(setUpIncomingMail) - d.addErrback(logger.err) + d.addErrback(logger.error) return d # -------------------------------------------------------------------- diff --git a/src/leap/bitmask/mail/adaptors/soledad.py b/src/leap/bitmask/mail/adaptors/soledad.py index 74f346b..4a8008d 100644 --- a/src/leap/bitmask/mail/adaptors/soledad.py +++ b/src/leap/bitmask/mail/adaptors/soledad.py @@ -1041,7 +1041,7 @@ class SoledadMailAdaptor(SoledadIndexMixin): Delete all messages flagged as deleted. """ def err(failure): - logger.errror(failure) + logger.error(failure) def delete_fdoc_and_mdoc_flagged(fdocs): # low level here, not using the wrappers... diff --git a/src/leap/bitmask/mail/imap/mailbox.py b/src/leap/bitmask/mail/imap/mailbox.py index 10ac01e..5e4fa6a 100644 --- a/src/leap/bitmask/mail/imap/mailbox.py +++ b/src/leap/bitmask/mail/imap/mailbox.py @@ -57,7 +57,7 @@ if PROFILE_CMD: def _debugProfiling(result, cmdname, start): took = (time.time() - start) * 1000 - log.msg("CMD " + cmdname + " TOOK: " + str(took) + " msec") + logger.debug("CMD " + cmdname + " TOOK: " + str(took) + " msec") return result def do_profile_cmd(d, name): @@ -68,7 +68,7 @@ if PROFILE_CMD: :type name: str """ d.addCallback(_debugProfiling, name, time.time()) - d.addErrback(lambda f: log.msg(f.getTraceback())) + d.addErrback(lambda f: logger.error(f.getTraceback())) INIT_FLAGS = (MessageFlags.SEEN_FLAG, MessageFlags.ANSWERED_FLAG, MessageFlags.FLAGGED_FLAG, MessageFlags.DELETED_FLAG, @@ -405,7 +405,7 @@ class IMAPMailbox(object): d = self.collection.add_msg(message, flags, date=date, notify_just_mdoc=notify_just_mdoc) - d.addErrback(lambda failure: log.err(failure)) + d.addErrback(lambda failure: logger.error(failure)) return d def notify_new(self, *args): @@ -430,7 +430,7 @@ class IMAPMailbox(object): d = self._get_notify_count() d.addCallback(cbNotifyNew) d.addCallback(self.collection.cb_signal_unread_to_ui) - d.addErrback(lambda failure: log.err(failure)) + d.addErrback(lambda failure: logger.error(failure)) def _get_notify_count(self): """ @@ -513,7 +513,7 @@ class IMAPMailbox(object): d = self._bound_seq(messages_asked, uid) if uid: d.addCallback(get_range) - d.addErrback(lambda f: log.err(f)) + d.addErrback(lambda f: logger.error(f)) return d def _bound_seq(self, messages_asked, uid): @@ -617,12 +617,12 @@ class IMAPMailbox(object): d = defer.gatherResults(d_msg, consumeErrors=True) d.addCallback(_get_imap_msg) d.addCallback(_zip_msgid) - d.addErrback(lambda failure: log.err(failure)) + d.addErrback(lambda failure: logger.error(failure)) return d d = self._get_messages_range(messages_asked, uid) d.addCallback(get_imap_messages_for_range) - d.addErrback(lambda failure: log.err(failure)) + d.addErrback(lambda failure: logger.error(failure)) return d def fetch_flags(self, messages_asked, uid): @@ -800,7 +800,7 @@ class IMAPMailbox(object): read-write. """ if not self.isWriteable(): - log.msg('read only mailbox!') + logger.info('read only mailbox!') raise imap4.ReadOnlyMailbox d = defer.Deferred() @@ -810,7 +810,7 @@ class IMAPMailbox(object): do_profile_cmd(d, "STORE") d.addCallback(self.collection.cb_signal_unread_to_ui) - d.addErrback(lambda f: log.err(f)) + d.addErrback(lambda f: logger.error(f)) return d def _do_store(self, messages_asked, flags, mode, uid, observer): -- cgit v1.2.3