18 from __future__
import annotations
20 from enum
import IntEnum
27 List of all log severities supported by Coretex
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")
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")
100 Prefix of the log severity
107 return self.name.capitalize()
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")
LogSeverity fromLevel(int logLevel)