EOX GitLab Instance

Skip to content
Snippets Groups Projects
Commit ea20fb93 authored by Bernhard Mallinger's avatar Bernhard Mallinger
Browse files

Setup config for structured logging

parent 3dba3663
No related branches found
No related tags found
1 merge request!12use structlog
......@@ -2,6 +2,7 @@ from os.path import join, dirname
import logging.config
import click
import structlog
import yaml
import jsonschema
......@@ -22,13 +23,20 @@ def setup_logging(debug=False):
{
"version": 1,
"disable_existing_loggers": False,
"formatters": {"brief": {"format": "%(levelname)s %(name)s: %(message)s"}},
"formatters": {
"json": {
"()": structlog.stdlib.ProcessorFormatter,
"processor": structlog.processors.JSONRenderer(),
# For nicer cli output:
# "processor": structlog.dev.ConsoleRenderer(),
},
},
"handlers": {
"console": {
"class": "logging.StreamHandler",
"level": "DEBUG" if debug else "INFO",
"formatter": "brief",
}
"formatter": "json",
},
},
"root": {
"handlers": ["console"],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment