sane date format for django.server
This commit is contained in:
parent
630d150bcc
commit
77ad852bf8
|
@ -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',
|
||||
|
|
Loading…
Reference in New Issue