first commit

This commit is contained in:
2025-07-24 20:13:47 +03:00
commit 94b7585f8b
175 changed files with 85264 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

25
app/utils/logger_util.py Normal file
View File

@ -0,0 +1,25 @@
import colorlog
import sys
import json
logger = colorlog.getLogger(__name__)
logger.setLevel(colorlog.DEBUG)
formatter = colorlog.ColoredFormatter(
"%(log_color)s%(levelname)-8s%(reset)s %(purple)s%(message)s",
datefmt=None,
reset=True,
log_colors={
'DEBUG': 'cyan',
'INFO': 'green',
'WARNING': 'yellow',
'ERROR': 'red',
'CRITICAL': 'red',
}
)
stream_handler = colorlog.StreamHandler(sys.stdout)
stream_handler.setFormatter(formatter)
logger.addHandler(stream_handler)
logger.json = lambda text: logger.debug(json.dumps(text, indent=4, sort_keys=True, default=str))

View File

@ -0,0 +1,15 @@
import time
from fastapi.responses import JSONResponse
from app.utils.logger_util import logger
def response(data: dict, start_time: float, code: int = 200) -> dict:
speed = time.time() - start_time
data["duration"] = speed
logger.debug(f"RESPONSE TIME: {speed}s")
if code != 200:
return JSONResponse(content=data, status_code=code)
return data