Subject: [PATCH django-impersonate] Downgrade signals logging from warning to debug

From: Hugo Rodger-Brown <[email-masked]>
Date: Thu, 10 Dec 2020 14:16:46 +0000

# HG changeset patch
# User Hugo Rodger-Brown <[email-masked]>
# Date 1607608487 0
#      Thu Dec 10 13:54:47 2020 +0000
# Branch downgrade-logging
# Node ID bd1429321fb4a7f4627448681d369d07875c5edf
# Parent  a174b1c67a73699e1ea51d1433db7d0f22c4e6ef
Downgrade signals logging from warning to debug

In production we are seeing the warnings raised by the
signals appearing frequently. I believe this is caused by
people having multiple tabs open, stopping impersonating
in one, and then some time later clicking the stop impersonate
link in another. This is a completely valid use case, and
shouldn't raise a warning.

diff --git a/impersonate/signals.py b/impersonate/signals.py
--- a/impersonate/signals.py
+++ b/impersonate/signals.py
@@ -87,7 +87,7 @@
         log.session_ended_at = tz_now()
         log.save()
     except ImpersonationLog.DoesNotExist:
-        logger.warning(
+        logger.debug(
             (u'Unfinished ImpersonationLog could not be found for: '
              u'{0}, {1}, {2}').format(
                  impersonator,
@@ -96,7 +96,7 @@
              )
         )
     except ImpersonationLog.MultipleObjectsReturned:
-        logger.warning(
+        logger.debug(
             (u'Multiple unfinished ImpersonationLog matching: '
              u'{0}, {1}, {2}').format(
                  impersonator,