Beracles commited on
Commit
e7d4173
·
1 Parent(s): fc7a233

优化日期路径格式化和时间戳精度,增强日志过滤功能

Browse files
Files changed (1) hide show
  1. logging_helper.py +3 -4
logging_helper.py CHANGED
@@ -170,7 +170,7 @@ class LoggingHelper:
170
  pathes = []
171
  current_date = from_date
172
  while current_date <= to_date:
173
- pathes.append(current_date.strftime("%Y/%m/%d"))
174
  current_date += datetime.timedelta(days=1)
175
  return pathes
176
 
@@ -296,13 +296,12 @@ class LoggingHelper:
296
  from_date = (
297
  datetime.datetime.strptime(from_date, "%Y-%m-%d")
298
  .astimezone(tz)
299
- .isoformat()
300
  )
301
- from_date = str(from_date)
302
  if isinstance(to_date, str):
303
  to_date = datetime.datetime.strptime(to_date, "%Y-%m-%d").astimezone(tz)
304
  to_date += datetime.timedelta(days=1) # 包含结束日期全天
305
- to_date = to_date.isoformat()
306
  print(f"[refresh] Filtering logs from {from_date} to {to_date}")
307
  # 按timestamp范围过滤(包含边界日期的全天数据)
308
  if from_date is not None or to_date is not None:
 
170
  pathes = []
171
  current_date = from_date
172
  while current_date <= to_date:
173
+ pathes.append(f"{current_date.year}/{current_date.month}/{current_date.day}")
174
  current_date += datetime.timedelta(days=1)
175
  return pathes
176
 
 
296
  from_date = (
297
  datetime.datetime.strptime(from_date, "%Y-%m-%d")
298
  .astimezone(tz)
299
+ .isoformat(timespec="microseconds")
300
  )
 
301
  if isinstance(to_date, str):
302
  to_date = datetime.datetime.strptime(to_date, "%Y-%m-%d").astimezone(tz)
303
  to_date += datetime.timedelta(days=1) # 包含结束日期全天
304
+ to_date = to_date.isoformat(timespec="microseconds")
305
  print(f"[refresh] Filtering logs from {from_date} to {to_date}")
306
  # 按timestamp范围过滤(包含边界日期的全天数据)
307
  if from_date is not None or to_date is not None: