mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-08-15 19:50:06 +08:00
Update request_logger.py
Saving api logs failed when Seedream4 official template was used on windows machine, due to the forbidden "=?:" characters in the filename, as well as the filename being too long. Regex keeps only usable characters, and 220 arbitrary max filename length is added.
This commit is contained in:
parent
b8730510db
commit
f854b66fc8
@ -5,6 +5,7 @@ import datetime
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import folder_paths
|
import folder_paths
|
||||||
|
import re
|
||||||
|
|
||||||
# Get the logger instance
|
# Get the logger instance
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -55,7 +56,8 @@ def log_request_response(
|
|||||||
"""
|
"""
|
||||||
log_dir = get_log_directory()
|
log_dir = get_log_directory()
|
||||||
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S_%f")
|
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S_%f")
|
||||||
filename = f"{timestamp}_{operation_id.replace('/', '_').replace(':', '_')}.log"
|
safe_operation_id = re.sub(r'[^A-Za-z0-9._-]', '_', operation_id)
|
||||||
|
filename = f"{timestamp}_{safe_operation_id}"[:220]+".log"
|
||||||
filepath = os.path.join(log_dir, filename)
|
filepath = os.path.join(log_dir, filename)
|
||||||
|
|
||||||
log_content = []
|
log_content = []
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user