1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-02-03 13:47:14 +03:00

small fixes

This commit is contained in:
Adolfo Gómez García 2023-04-20 04:47:46 +02:00
parent 06a598d577
commit 41a499a35c
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23
2 changed files with 4 additions and 4 deletions

View File

@ -45,9 +45,9 @@ if typing.TYPE_CHECKING:
useLogger = logging.getLogger('useLog')
# Patter for look for date and time in this format: 2023-04-20 04:03:08,776
# Patter 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[re.Pattern] = re.compile(r'(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3})')
DATETIME_PATTERN: typing.Final[re.Pattern] = re.compile(r'(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3}) *')
class LogLevel(enum.IntEnum):
@ -183,7 +183,7 @@ class UDSLogHandler(logging.handlers.RotatingFileHandler):
emiting: typing.ClassVar[bool] = False
def emit(self, record: logging.LogRecord) -> None:
if apps.ready and record.levelno > logging.INFO and not UDSLogHandler.emiting:
if apps.ready and record.levelno >= logging.INFO and not UDSLogHandler.emiting:
try:
UDSLogHandler.emiting = True
msg = self.format(record)

View File

@ -73,7 +73,7 @@ def getSqlDatetime() -> datetime:
if connection.vendor in ('mysql', 'microsoft'):
cursor = connection.cursor()
sentence = (
'SELECT NOW()'
'SELECT CURRENT_TIMESTAMP(4)'
if connection.vendor == 'mysql'
else 'SELECT CURRENT_TIMESTAMP'
)