dev: logging cofiguration

This commit is contained in:
pablohashescobar 2024-03-15 15:39:10 +05:30
parent 192482dc30
commit aa2d61cdf7

View File

@ -6,7 +6,7 @@ from .common import * # noqa
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = int(os.environ.get("DEBUG", 0)) == 1 DEBUG = int(os.environ.get("DEBUG", 0)) == 1
DEBUG = True
# Honor the 'X-Forwarded-Proto' header for request.is_secure() # Honor the 'X-Forwarded-Proto' header for request.is_secure()
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https") SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
@ -42,27 +42,33 @@ LOGGING = {
"handlers": { "handlers": {
"console": { "console": {
"class": "logging.StreamHandler", "class": "logging.StreamHandler",
"formatter": "json", "formatter": "verbose",
"level": "INFO",
}, },
"file": { "file": {
"class": "plane.utils.logging.SizedTimedRotatingFileHandler", "class": "plane.utils.logging.SizedTimedRotatingFileHandler",
"filename": os.path.join(BASE_DIR, "logs", "plane.log"), # noqa "filename": (
"when": "midnight", os.path.join(BASE_DIR, "logs", "plane-debug.log") # noqa
if DEBUG
else os.path.join(BASE_DIR, "logs", "plane-error.log") # noqa
),
"when": "s",
"maxBytes": 1024 * 1024 * 1, "maxBytes": 1024 * 1024 * 1,
"interval": 1, "interval": 1,
"backupCount": 5, "backupCount": 5,
"formatter": "json", "formatter": "json",
"level": "DEBUG" if DEBUG else "ERROR",
}, },
}, },
"loggers": { "loggers": {
"django": { "django": {
"handlers": ["console", "file"], "handlers": ["console", "file"],
"level": "DEBUG" if DEBUG else "ERROR", "level": "INFO",
"propagate": True, "propagate": True,
}, },
"django.request": { "django.request": {
"handlers": ["console", "file"], "handlers": ["console", "file"],
"level": "DEBUG" if DEBUG else "ERROR", "level": "INFO",
"propagate": False, "propagate": False,
}, },
"plane": { "plane": {