Inherits IntEnum.
List of all log severities supported by Coretex
Definition at line 24 of file severity.py.
◆ color()
int coretex.logging.severity.LogSeverity.color |
( |
|
self | ) |
|
ANSI color of the log severity
Returns
-------
str -> color
Definition at line 37 of file severity.py.
37 def color(self) -> int:
39 ANSI color of the log severity
46 if self == LogSeverity.fatal:
49 if self == LogSeverity.error:
52 if self == LogSeverity.warning:
55 if self == LogSeverity.info:
58 if self == LogSeverity.debug:
61 raise RuntimeError(
">> [Coretex] Invalid enum value")
◆ fromLevel()
LogSeverity coretex.logging.severity.LogSeverity.fromLevel |
( |
int |
logLevel | ) |
|
|
static |
Converts python std module logging level
into the equivalent log severity from coretex
Returns
-------
LogSeverity -> Coretex log severity
Example
-------
>>> import logging
\b
>>> from coretex.logging.log_severity import LogSeverity
>>> logSeverityValue = LogSeverity.fromStd(logging.INFO)
>>> print(logSeverityValue)
LogSeverity.info
Definition at line 110 of file severity.py.
110 def fromLevel(logLevel: int) -> LogSeverity:
112 Converts python std module logging level
113 into the equivalent log severity from coretex
117 LogSeverity -> Coretex log severity
123 >>> from coretex.logging.log_severity import LogSeverity
124 >>> logSeverityValue = LogSeverity.fromStd(logging.INFO)
125 >>> print(logSeverityValue)
129 if logLevel == logging.FATAL:
130 return LogSeverity.fatal
132 if logLevel == logging.ERROR:
133 return LogSeverity.error
135 if logLevel == logging.WARNING:
136 return LogSeverity.warning
138 if logLevel == logging.INFO:
139 return LogSeverity.info
141 if logLevel == logging.DEBUG:
142 return LogSeverity.debug
144 raise ValueError(
">> [Coretex] Invalid enum value")
◆ getLevel()
int coretex.logging.severity.LogSeverity.getLevel |
( |
|
self | ) |
|
Converts Coretex log severity into the
equivalent log level from python std module logging
Returns
-------
int -> python std module logging level
Example
-------
>>> from coretex.logging import LogSeverity
\b
>>> print(LogSeverity.info.stdSeverity)
20
Definition at line 63 of file severity.py.
63 def getLevel(self) -> int:
65 Converts Coretex log severity into the
66 equivalent log level from python std module logging
70 int -> python std module logging level
74 >>> from coretex.logging import LogSeverity
76 >>> print(LogSeverity.info.stdSeverity)
80 if self == LogSeverity.fatal:
83 if self == LogSeverity.error:
86 if self == LogSeverity.warning:
87 return logging.WARNING
89 if self == LogSeverity.info:
92 if self == LogSeverity.debug:
95 raise RuntimeError(
">> [Coretex] Invalid enum value")
◆ prefix()
str coretex.logging.severity.LogSeverity.prefix |
( |
|
self | ) |
|
Prefix of the log severity
Returns
-------
str -> prefix
Definition at line 98 of file severity.py.
98 def prefix(self) -> str:
100 Prefix of the log severity
107 return self.name.capitalize()
The documentation for this class was generated from the following file: