Add support for JSON log format. #7138

This commit is contained in:
Florian
2024-02-22 12:09:25 +01:00
committed by GitHub
parent dee1a2ae6b
commit 16406f88a7
4 changed files with 31 additions and 4 deletions

View File

@@ -15,6 +15,7 @@ import builtins
import logging
import os
import sys
from collections import OrderedDict
# We need to include the root directory in sys.path to ensure that we can
# find everything we need when running in the standalone runtime.
@@ -256,6 +257,20 @@ CONSOLE_LOG_LEVEL = logging.WARNING
FILE_LOG_LEVEL = logging.WARNING
# Log format.
JSON_LOGGER = False
CONSOLE_LOG_FORMAT_JSON = OrderedDict([
("time", "asctime"),
("message", "message"),
("level", "levelname")
])
FILE_LOG_FORMAT_JSON = OrderedDict([
("time", "asctime"),
("message", "message"),
("level", "levelname")
])
CONSOLE_LOG_FORMAT = '%(asctime)s: %(levelname)s\t%(name)s:\t%(message)s'
FILE_LOG_FORMAT = '%(asctime)s: %(levelname)s\t%(name)s:\t%(message)s'