elastic/ecs-logging-python

Add an example on how to configure with dictConfig + StdlibFormatter

sethmlarson opened this issue · 0 comments

LOGGING_CONFIG = {
             "format": "[%(asctime)s.%(msecs)03d] %(levelname)s %(name)s:%(funcName)s: %(message)s",
             "datefmt": "%d/%b/%Y:%H:%M:%S",
         },
+        "ecs": {
+            "()": "ecs_logging.StdlibFormatter"
+        },
         "access": {"format": "%(message)s",},
     },
     "handlers": {
         "default": {
             "class": "logging.StreamHandler",
             "stream": "ext://sys.stdout",
-            "formatter": "default",
+            "formatter": "ecs",
         },
         "access_logs": {
             "class": "logging.StreamHandler",