mirror of
https://github.com/GSA/notifications-admin.git
synced 2025-12-17 10:34:07 -05:00
fix bug where only exception is passed to logger
This commit is contained in:
@@ -141,6 +141,10 @@ class PIIFilter(logging.Filter):
|
|||||||
# and email addresses, masking them. Ultimately this will probably get
|
# and email addresses, masking them. Ultimately this will probably get
|
||||||
# refactored into a 'SafeLogger' subclass or something, but let's start here
|
# refactored into a 'SafeLogger' subclass or something, but let's start here
|
||||||
# with phones.
|
# with phones.
|
||||||
|
|
||||||
|
# Sometimes just an exception object is passed in for the message, skip those.
|
||||||
|
if not isinstance(msg, str):
|
||||||
|
return msg
|
||||||
phones = re.findall("(?:\\+ *)?\\d[\\d\\- ]{7,}\\d", msg)
|
phones = re.findall("(?:\\+ *)?\\d[\\d\\- ]{7,}\\d", msg)
|
||||||
phones = [phone.replace("-", "").replace(" ", "") for phone in phones]
|
phones = [phone.replace("-", "").replace(" ", "") for phone in phones]
|
||||||
for phone in phones:
|
for phone in phones:
|
||||||
|
|||||||
Reference in New Issue
Block a user