👍️[Update] Main : error logのトレースバックの処理を集約

This commit is contained in:
misygauziya
2024-12-16 14:22:49 +09:00
parent 8a4721b61d
commit 030b8a9f01
5 changed files with 26 additions and 24 deletions

View File

@@ -4,6 +4,7 @@ import json
import random
from typing import Union
from os import path as os_path, rename as os_rename
import traceback
from PIL.Image import open as Image_open
def getImageFile(file_name):
@@ -93,4 +94,9 @@ def printResponse(status:int, endpoint:str, result:Any=None) -> None:
f.write(f"log: {response}\n")
response = json.dumps(response)
print(response, flush=True)
print(response, flush=True)
def errorLogging(error:Exception) -> None:
with open('error.log', 'a') as f:
f.write(f"error: {error}\n")
traceback.print_exc(file=f)