mirror of
https://github.com/AudebertAdrien/ft_transcendence.git
synced 2026-11-10 00:57:07 +01:00
before thouch change
This commit is contained in:
@@ -6,8 +6,9 @@ Django settings for pong project.
|
||||
Generated by 'django-admin startproject' using Django 3.2.
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
import os
|
||||
import logging.config
|
||||
from pathlib import Path
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
@@ -134,3 +135,38 @@ CHANNEL_LAYERS = {
|
||||
'BACKEND': 'channels.layers.InMemoryChannelLayer',
|
||||
},
|
||||
}
|
||||
|
||||
LOGGING = {
|
||||
'version': 1, # The version of the logging configuration schema
|
||||
'disable_existing_loggers': False, # Allows existing loggers to keep logging
|
||||
'formatters': { # Defines how log messages will be formatted
|
||||
'json': {
|
||||
'()': 'pythonjsonlogger.jsonlogger.JsonFormatter',
|
||||
# Formatter that outputs logs in JSON format, which is ideal for ingestion by Logstash.
|
||||
},
|
||||
'default': {
|
||||
'format': '[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s',
|
||||
# This is a basic text formatter with timestamp, log level, logger name, line number, and the actual message.
|
||||
},
|
||||
},
|
||||
'handlers': { # Handlers determine where the log messages are sent
|
||||
'file': {
|
||||
'level': 'INFO', # Minimum log level to be handled (INFO and above)
|
||||
'class': 'logging.FileHandler',
|
||||
'filename': os.path.join(BASE_DIR, 'django.log'), # The file where logs will be saved
|
||||
'formatter': 'json', # Uses the JSON formatter defined above
|
||||
},
|
||||
'console': {
|
||||
'level': 'DEBUG', # Minimum log level to be handled (DEBUG and above)
|
||||
'class': 'logging.StreamHandler',
|
||||
'formatter': 'default', # Uses the default text formatter
|
||||
},
|
||||
},
|
||||
'loggers': { # Loggers are the actual log streams that get configured
|
||||
'django': { # The Django logger catches all messages sent by the Django framework
|
||||
'handlers': ['file', 'console'], # Sends logs to both the file and the console
|
||||
'level': 'DEBUG', # Minimum log level to be logged
|
||||
'propagate': True, # If True, messages will be passed to the parent loggers as well
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user