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.

registration: Do getLogger() instead of direct "logging.<level>" calls.

Mateusz Manderab966397d25f6
diff --git a/zerver/views/registration.py b/zerver/views/registration.py
index 653359807d8..f804305859d 100644
--- a/zerver/views/registration.py
+++ b/zerver/views/registration.py
@@ -137,6 +137,8 @@ from zproject.backends import (
password_auth_enabled,
)
+logger = logging.getLogger("")
+
@typed_endpoint
def get_prereg_key_and_redirect(
@@ -507,7 +509,7 @@ def registration_helper(
try:
ldap_username = backend.django_to_ldap_username(email)
except NoMatchingLDAPUserError:
- logging.warning("New account email %s could not be found in LDAP", email)
+ logger.warning("New account email %s could not be found in LDAP", email)
break
# Note that this `ldap_user` object is not a
@@ -860,7 +862,7 @@ def registration_helper(
)
if return_data.get("invalid_subdomain"):
# By construction, this should never happen.
- logging.error(
+ logger.error(
"Subdomain mismatch in registration %s: %s",
realm.subdomain,
user_profile.delivery_email,
@@ -1315,7 +1317,7 @@ def create_realm(request: HttpRequest, creation_key: str | None = None) -> HttpR
request=request,
)
except EmailNotDeliveredError:
- logging.exception("Failed to deliver email during realm creation")
+ logger.exception("Failed to deliver email during realm creation")
if settings.CORPORATE_ENABLED:
return render(request, "500.html", status=500)
return config_error(request, "smtp")
@@ -1482,7 +1484,7 @@ def accounts_home(
try:
send_confirm_registration_email(email, activation_url, request=request, realm=realm)
except EmailNotDeliveredError:
- logging.exception("Failed to deliver email during user registration")
+ logger.exception("Failed to deliver email during user registration")
if settings.CORPORATE_ENABLED:
return render(request, "500.html", status=500)
return config_error(request, "smtp")