wacca: add traceback printing

This commit is contained in:
Hay1tsme 2023-11-17 10:57:12 -05:00
parent 69cd79003c
commit 9a017f75e9
1 changed files with 5 additions and 2 deletions

View File

@ -7,6 +7,7 @@ from hashlib import md5
from twisted.web.http import Request from twisted.web.http import Request
from typing import Dict, Tuple, List from typing import Dict, Tuple, List
from os import path from os import path
import traceback
from core import CoreConfig, Utils from core import CoreConfig, Utils
from .config import WaccaConfig from .config import WaccaConfig
@ -173,8 +174,10 @@ class WaccaServlet:
self.logger.error( self.logger.error(
f"{req_json['appVersion']} Error handling method {url_path} -> {e}" f"{req_json['appVersion']} Error handling method {url_path} -> {e}"
) )
if self.core_cfg.server.is_develop: if self.logger.level == logging.DEBUG:
raise traceback.print_exception(e, limit=1)
with open("{0}/{1}.log".format(self.core_cfg.server.log_dir, "wacca"), "a") as f:
traceback.print_exception(e, limit=1, file=f)
resp = BaseResponse() resp = BaseResponse()
resp.status = 1 resp.status = 1