diff options
author | Nino van Hooff <ninovanhooff@gmail.com> | 2020-02-24 17:27:17 +0300 |
---|---|---|
committer | Nino van Hooff <ninovanhooff@gmail.com> | 2020-02-24 17:27:17 +0300 |
commit | 62dfadecdface687841930de70f12d151961f47e (patch) | |
tree | 0c93d07754ce8dd788f62c4d3f9aff422c3d1ffa /plugins/SentryLogger | |
parent | e52dc56a64186812d48ca4b7d7e318ff24401142 (diff) |
Prune all sensitive data before sending it to Sentry
CURA-7245
Diffstat (limited to 'plugins/SentryLogger')
-rw-r--r-- | plugins/SentryLogger/SentryLogger.py | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/plugins/SentryLogger/SentryLogger.py b/plugins/SentryLogger/SentryLogger.py index 31ab38b6e2..51e77ad589 100644 --- a/plugins/SentryLogger/SentryLogger.py +++ b/plugins/SentryLogger/SentryLogger.py @@ -3,6 +3,9 @@ from UM.Logger import LogOutput from typing import Set + +from cura.CrashHandler import CrashHandler + try: from sentry_sdk import add_breadcrumb except ImportError: @@ -10,8 +13,6 @@ except ImportError: from typing import Optional import os -home_dir = os.path.expanduser("~") - class SentryLogger(LogOutput): # Sentry (https://sentry.io) is the service that Cura uses for logging crashes. This logger ensures that the @@ -37,7 +38,7 @@ class SentryLogger(LogOutput): # \param message String containing message to be logged def log(self, log_type: str, message: str) -> None: level = self._translateLogType(log_type) - message = self._pruneSensitiveData(message) + message = CrashHandler.pruneSensitiveData(message) if level is None: if message not in self._show_once: level = self._translateLogType(log_type[0]) @@ -48,11 +49,5 @@ class SentryLogger(LogOutput): add_breadcrumb(level = level, message = message) @staticmethod - def _pruneSensitiveData(message): - if home_dir in message: - message = message.replace(home_dir, "<user_home>") - return message - - @staticmethod def _translateLogType(log_type: str) -> Optional[str]: return SentryLogger._levels.get(log_type) |