filtering the email from user

This commit is contained in:
hjoaquim
2023-01-27 10:51:35 +00:00
parent 46854d2676
commit f6fd627761
2 changed files with 1 additions and 8 deletions

View File

@@ -5,13 +5,9 @@ import re
# IMPORTATION THIRDPARTY
# IMPORTATION INTERNAL
from openbb_terminal.core.log.generation.user_logger import __name__ as user_logger_name
from openbb_terminal.core.config.paths import HOME_DIRECTORY
from openbb_terminal.core.log.generation.settings import AppSettings
# considering starting at 0 and after the logging prefix i.e., just the text to be filtered
MODULE_POSITION = 1
class FormatterWithExceptions(logging.Formatter):
"""Logging Formatter that includes formatting of Exceptions"""
@@ -58,9 +54,6 @@ class FormatterWithExceptions(logging.Formatter):
@staticmethod
def mock_email(text: str) -> str:
if text.split("|")[MODULE_POSITION] == user_logger_name:
return text
pattern = r"\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b"
replacement = " FILTERED_EMAIL "
text_mocked = re.sub(pattern, replacement, text)

View File

@@ -23,5 +23,5 @@ def log_user(with_rollover: bool = True):
def log_user_info():
"""Log user info"""
user_info = {"user_uuid": User.get_uuid(), "user_email": User.get_email()}
user_info = {"user_uuid": User.get_uuid()}
logger.info("USER: %s ", json.dumps(user_info))