diff --git a/zerver/lib/fix_unreads.py b/zerver/lib/fix_unreads.py index 83576fe48b..24b283ea66 100644 --- a/zerver/lib/fix_unreads.py +++ b/zerver/lib/fix_unreads.py @@ -94,7 +94,7 @@ def fix_unsubscribed(cursor: CursorWrapper, user_profile: UserProfile) -> None: rows = cursor.fetchall() for row in rows: recipient_ids.append(row[0]) - logger.info(str(recipient_ids)) + logger.info("%s", recipient_ids) get_timing( "get recipients", diff --git a/zerver/lib/send_email.py b/zerver/lib/send_email.py index ab4209e3cc..ed067594d5 100644 --- a/zerver/lib/send_email.py +++ b/zerver/lib/send_email.py @@ -289,9 +289,7 @@ def send_email( ) raise EmailNotDeliveredException except smtplib.SMTPException as e: - logger.exception( - "Error sending %s email to %s: %s", template, mail.to, str(e), stack_info=True - ) + logger.exception("Error sending %s email to %s: %s", template, mail.to, e, stack_info=True) raise EmailNotDeliveredException diff --git a/zerver/worker/queue_processors.py b/zerver/worker/queue_processors.py index 5131de2792..9b0caa72e5 100644 --- a/zerver/worker/queue_processors.py +++ b/zerver/worker/queue_processors.py @@ -958,7 +958,7 @@ class EmbeddedBotWorker(QueueProcessingWorker): bot_handler=self.get_bot_api_client(user_profile), ) except EmbeddedBotQuitException as e: - logging.warning(str(e)) + logging.warning("%s", e) @assign_queue("deferred_work") diff --git a/zproject/backends.py b/zproject/backends.py index 6e9827b53c..f473a7a7c5 100644 --- a/zproject/backends.py +++ b/zproject/backends.py @@ -1822,12 +1822,12 @@ class SocialAuthMixin(ZulipAuthMixin, ExternalAuthMethod, BaseAuth): # the flow or the IdP is unreliable and returns a bad http response), # don't throw a 500, just send them back to the # login page and record the event at the info log level. - self.logger.info("%s: %s", type(e).__name__, str(e)) + self.logger.info("%s: %s", type(e).__name__, e) return None except SocialAuthBaseException as e: # Other python-social-auth exceptions are likely # interesting enough that we should log a warning. - self.logger.warning(str(e)) + self.logger.warning("%s", e) return None def should_auto_signup(self) -> bool: