mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 13:01:38 +00:00
Anonymize logged in users flair in logs (#4861)
* Anonymize logged in users flair in logs #4838 * small improvement to regular expression --------- Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>
This commit is contained in:
@@ -65,6 +65,14 @@ class FormatterWithExceptions(logging.Formatter):
|
||||
text_mocked = re.sub(pattern, replacement, text)
|
||||
return text_mocked
|
||||
|
||||
@staticmethod
|
||||
def mock_flair(text: str) -> str:
|
||||
pattern = r'("FLAIR": "\[)(.*?)\]'
|
||||
replacement = r"\1 FILTERED_FLAIR ]"
|
||||
text_mocked = re.sub(pattern, replacement, text)
|
||||
|
||||
return text_mocked
|
||||
|
||||
@staticmethod
|
||||
def mock_home_directory(text: str) -> str:
|
||||
user_home_directory = str(HOME_DIRECTORY)
|
||||
@@ -85,6 +93,7 @@ class FormatterWithExceptions(logging.Formatter):
|
||||
text_filtered = cls.mock_email(text=text_filtered)
|
||||
text_filtered = cls.mock_password(text=text_filtered)
|
||||
text_filtered = cls.mock_home_directory(text=text_filtered)
|
||||
text_filtered = cls.mock_flair(text=text_filtered)
|
||||
|
||||
return text_filtered
|
||||
|
||||
|
||||
Reference in New Issue
Block a user