diff --git a/registrar/cli.py b/registrar/cli.py index edfd96e66b67feae55f6aab6b789c6f88439eec7..208136e9614d6748a351c159d670dd277a5ff1e7 100644 --- a/registrar/cli.py +++ b/registrar/cli.py @@ -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"], diff --git a/requirements.txt b/requirements.txt index 643596764c373cac4bb97e2e6587980f9c321854..f86eb6515c1c53b3ac3db20c191272fd9dd005ac 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,5 +6,6 @@ pyyaml<6.0 jsonschema<5.0 boto3<2.0 django-cors-headers<4.0 +django-structlog==2.2. pystac<2.0 http-access==0.1.3