mozilla-services / python-dockerflow

A Python package to implement tools and helpers for Mozilla Dockerflow
https://python-dockerflow.readthedocs.io
Mozilla Public License 2.0
38 stars 21 forks source link

Establish a standard logging format through this library, with the ability to customize #113

Open grahamalama opened 4 months ago

grahamalama commented 4 months ago

Though we want to add the ability to emit logs in the format that's most useful for engineers (see #111), we also want to promote a standard logging format to reduce the cognitive overhead of switching between projects and provide the ability to more-easily search for logs that span multiple services.

The idea would be that instead of encouraging engineers to reference a format-specific class in their logging configuration (e.g. dockerflow.logging.MozlogHandler or google.cloud.logging.handlers.StructuredLogHandler), we can establish a generic class name like:

'console': {
    'class': 'dockerflow.logging.DefaultHandler', #real name tbd
},

with some sort of ability to configure the class through an environment variable, like:

os.getenv("DOCKERFLOW_LOGGING_FORMAT", "MOZLOG")

With this setup, engineers have the freedom to: