Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

python: Use format string for logging str(obj).

Anders Kaseorgb45484573e49
diff --git a/zerver/lib/fix_unreads.py b/zerver/lib/fix_unreads.py
index 83576fe48bc..24b283ea669 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 ab4209e3cc9..ed067594d50 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 5131de2792a..9b0caa72e51 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 6e9827b53cc..f473a7a7c54 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: