mirror of
https://github.com/ShaYmez/pYSFReflector.git
synced 2026-01-14 17:45:29 -05:00
Fix datetime.UTC compatibility issue for Python < 3.11
Co-authored-by: ShaYmez <76499782+ShaYmez@users.noreply.github.com>
This commit is contained in:
parent
87a7a67cae
commit
36c299487d
@ -836,7 +836,7 @@ def printlog(log_level, mess):
|
||||
global debug
|
||||
|
||||
if file_rotate == "1":
|
||||
log_file = log_basename + '-' + str(datetime.datetime.now(datetime.UTC).strftime('%Y-%m-%d')) + '.log'
|
||||
log_file = log_basename + '-' + str(datetime.datetime.now(datetime.timezone.utc).strftime('%Y-%m-%d')) + '.log'
|
||||
else:
|
||||
log_file = log_basename + '.log'
|
||||
try:
|
||||
@ -850,10 +850,10 @@ def printlog(log_level, mess):
|
||||
str_log = None
|
||||
if isinstance(log_level, int):
|
||||
if file_level <= log_level:
|
||||
str_log = check_string('M: ' + str(datetime.datetime.now(datetime.UTC).strftime('%Y-%m-%d %H:%M:%S.%f'))[:-3] + ' ' + mess)
|
||||
str_log = check_string('M: ' + str(datetime.datetime.now(datetime.timezone.utc).strftime('%Y-%m-%d %H:%M:%S.%f'))[:-3] + ' ' + mess)
|
||||
else:
|
||||
if log_level == "d" and debug == 1:
|
||||
str_log = check_string('D: ' + str(datetime.datetime.now(datetime.UTC).strftime('%Y-%m-%d %H:%M:%S.%f'))[:-3] + ' ' + mess)
|
||||
str_log = check_string('D: ' + str(datetime.datetime.now(datetime.timezone.utc).strftime('%Y-%m-%d %H:%M:%S.%f'))[:-3] + ' ' + mess)
|
||||
if str_log is not None:
|
||||
try:
|
||||
filelog.write(str_log + '\n')
|
||||
@ -910,7 +910,7 @@ debug = config[13]
|
||||
|
||||
### log
|
||||
if file_rotate == "1":
|
||||
log_file = log_basename + '-' + str(datetime.datetime.now(datetime.UTC).strftime('%Y-%m-%d')) + '.log'
|
||||
log_file = log_basename + '-' + str(datetime.datetime.now(datetime.timezone.utc).strftime('%Y-%m-%d')) + '.log'
|
||||
else:
|
||||
log_file = log_basename + '.log'
|
||||
try:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user