mirror of
https://github.com/ShaYmez/pYSFReflector.git
synced 2026-04-06 15:05:35 -04:00
Merge pull request #2 from ShaYmez/copilot/fix-datetime-utc-attribute-error
Replace datetime.UTC with datetime.timezone.utc for Python <3.11 compatibility
This commit is contained in:
commit
f69dca1510
@ -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