1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-22 13:34:04 +03:00

small improvement for loglevel handling in log.py

This commit is contained in:
Adolfo Gómez García 2024-04-10 20:57:55 +02:00
parent e6778eda38
commit cf8498ad37
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23

View File

@ -50,6 +50,7 @@ if typing.TYPE_CHECKING:
useLogger = logging.getLogger('useLog')
# Pattern for look for date and time in this format: 2023-04-20 04:03:08,776 (and trailing spaces)
# This is the format used by python logging module
DATETIME_PATTERN: typing.Final[typing.Pattern[str]] = re.compile(r'(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3}) *')
@ -76,7 +77,8 @@ class LogLevel(enum.IntEnum):
def from_str(level: str) -> 'LogLevel':
try:
return LogLevel[level.upper()]
except KeyError:
except Exception:
# logger.error('Error getting log level from string: %s', e)
return LogLevel.OTHER
@staticmethod