Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaime van Kessel <nallath@gmail.com>2019-12-16 13:11:28 +0300
committerJaime van Kessel <nallath@gmail.com>2019-12-16 13:11:28 +0300
commit7c9d7a3aef068a77d4842949675f7443dd5b9027 (patch)
tree629c6f8af2428b892b610f265e9c4ed2f9c3538c /plugins/SentryLogger
parent8fa6239365a598fabd3bb09eeeebcf4f182f3842 (diff)
Clean up the _translateLogType
This makes it a bit easier to read
Diffstat (limited to 'plugins/SentryLogger')
-rw-r--r--plugins/SentryLogger/SentryLogger.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/plugins/SentryLogger/SentryLogger.py b/plugins/SentryLogger/SentryLogger.py
index 3cc94f83ef..76d6b4077b 100644
--- a/plugins/SentryLogger/SentryLogger.py
+++ b/plugins/SentryLogger/SentryLogger.py
@@ -9,7 +9,16 @@ import os
home_dir = os.path.expanduser("~")
+
class SentryLogger(LogOutput):
+ _levels = {
+ "w": "warning",
+ "i": "info",
+ "c": "fatal",
+ "e": "error",
+ "d": "debug"
+ }
+
def __init__(self) -> None:
super().__init__()
self._show_once = set() # type: Set[str]
@@ -37,16 +46,4 @@ class SentryLogger(LogOutput):
@staticmethod
def _translateLogType(log_type: str) -> Optional[str]:
- level = None
- if log_type == "w":
- level = "warning"
- elif log_type == "i":
- level = "info"
- elif log_type == "c":
- level = "fatal"
- elif log_type == "e":
- level = "error"
- elif log_type == "d":
- level = "debug"
-
- return level
+ return SentryLogger._levels.get(log_type)