first commit

This commit is contained in:
A'zamov Samandar
2025-11-21 14:41:16 +05:00
commit 256e80cc23
161 changed files with 7052 additions and 0 deletions

60
config/conf/logs.py Normal file
View File

@@ -0,0 +1,60 @@
import os
from pathlib import Path
import logging
BASE_DIR = Path(__file__).resolve().parent.parent.parent
LOG_DIR = BASE_DIR / "resources/logs"
os.makedirs(LOG_DIR, exist_ok=True)
class ExcludeErrorsFilter:
def filter(self, record):
return record.levelno <= logging.ERROR
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"verbose": {
"format": "%(asctime)s %(name)s %(levelname)s %(filename)s:%(lineno)d - %(message)s",
},
},
"filters": {
"exclude_errors": {
"()": ExcludeErrorsFilter,
},
},
"handlers": {
"daily_rotating_file": {
"level": "INFO",
"class": "logging.handlers.TimedRotatingFileHandler",
"filename": LOG_DIR / "django.log",
"when": "midnight",
"backupCount": 30,
"formatter": "verbose",
"filters": ["exclude_errors"],
},
"error_file": {
"level": "ERROR",
"class": "logging.handlers.TimedRotatingFileHandler",
"filename": LOG_DIR / "django_error.log",
"when": "midnight",
"backupCount": 30,
"formatter": "verbose",
},
},
"loggers": {
"django": {
"handlers": ["daily_rotating_file", "error_file"],
"level": "INFO",
"propagate": True,
},
"root": {
"handlers": ["daily_rotating_file", "error_file"],
"level": "INFO",
"propagate": True,
},
},
}