mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-15 10:47:49 -06:00
Clean up the _translateLogType
This makes it a bit easier to read
This commit is contained in:
parent
8fa6239365
commit
7c9d7a3aef
1 changed files with 10 additions and 13 deletions
|
@ -9,7 +9,16 @@ import os
|
||||||
|
|
||||||
home_dir = os.path.expanduser("~")
|
home_dir = os.path.expanduser("~")
|
||||||
|
|
||||||
|
|
||||||
class SentryLogger(LogOutput):
|
class SentryLogger(LogOutput):
|
||||||
|
_levels = {
|
||||||
|
"w": "warning",
|
||||||
|
"i": "info",
|
||||||
|
"c": "fatal",
|
||||||
|
"e": "error",
|
||||||
|
"d": "debug"
|
||||||
|
}
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._show_once = set() # type: Set[str]
|
self._show_once = set() # type: Set[str]
|
||||||
|
@ -37,16 +46,4 @@ class SentryLogger(LogOutput):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _translateLogType(log_type: str) -> Optional[str]:
|
def _translateLogType(log_type: str) -> Optional[str]:
|
||||||
level = None
|
return SentryLogger._levels.get(log_type)
|
||||||
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
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue