From 77ad852bf84e528aeb1981d23f1e876dc8953f3b Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Sun, 4 Jun 2023 00:13:05 +0200 Subject: [PATCH] sane date format for django.server --- gawa/gawa/settings.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/gawa/gawa/settings.py b/gawa/gawa/settings.py index 3551256..9fd1b7f 100644 --- a/gawa/gawa/settings.py +++ b/gawa/gawa/settings.py @@ -15,6 +15,7 @@ import os # default django from pathlib import Path +from django.utils.log import ServerFormatter # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -172,6 +173,9 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' import logging +myServerFormatter = ServerFormatter +myServerFormatter.default_time_format = "%Y-%M-%d %H:%M:%S" + LOGGING = { "version": 1, "disable_existing_loggers": False, @@ -185,27 +189,27 @@ LOGGING = { }, "formatters": { "django.server": { - "()": "django.utils.log.ServerFormatter", - 'format': '[{levelname}][{name}][{server_time}] "{message}"', + "()": "gawa.settings.myServerFormatter", + 'format': '[{asctime}][{levelname}][{name}] {message}', "style": "{", }, 'verbose': { - 'format': '[{asctime}][{levelname}][{name}] "{message}"', + 'format': '[{asctime}][{levelname}][{name}] {message}', 'style': '{', }, 'mail': { 'level': 'DEBUG', - 'format': '[{asctime}][{levelname}][{name}]\n"{message}"', + 'format': '[{asctime}][{levelname}][{name}]\n\n{message}', 'style': '{', }, 'simple': { 'level': 'DEBUG', - 'format': '[{levelname}][{name}] "{message}"', + 'format': '[{levelname}][{name}] {message}', 'style': '{', }, 'fancym': { '()': 'colorlog.ColoredFormatter', - 'format': '%(log_color)s[%(asctime)s][%(levelname)s][%(name)s]:\n[%(message)s]', + 'format': '%(log_color)s[%(asctime)s][%(levelname)s][%(name)s]\n[%(message)s]', 'log_colors': { 'DEBUG': 'cyan', 'INFO': 'green', @@ -216,7 +220,7 @@ LOGGING = { }, 'fancy': { '()': 'colorlog.ColoredFormatter', - 'format': '%(log_color)s[%(asctime)s][%(levelname)s][%(name)s] "%(message)s"', + 'format': '%(log_color)s[%(asctime)s][%(levelname)s][%(name)s] %(message)s', 'log_colors': { 'DEBUG': 'cyan', 'INFO': 'green', @@ -227,7 +231,7 @@ LOGGING = { }, 'fancy_internal': { '()': 'colorlog.ColoredFormatter', - 'format': '%(log_color)s[%(asctime)s][%(levelname)s][%(name)s] "%(message)s"', + 'format': '%(log_color)s[%(asctime)s][%(levelname)s][%(name)s] %(message)s', 'log_colors': { 'DEBUG': 'thin_cyan', 'INFO': 'thin_green',