microcosm-logging

Opinionated logging configuration


Keywords
microcosm
License
Other
Install
pip install microcosm-logging==1.7.0

Documentation

microcosm-logging

Opinionated logging configuration using microcosm wiring.

Circle CI

Usage

from microcosm.api import create_object_graph

graph = create_object_graph(name="foo")
graph.use("logger")

Convention

  • Logging should "just work" without large amounts of configuration
  • Outside of development and unittesting, log aggregation should be automatic (e.g. to loggly)
  • INFO level logging should be the default behavior; third-party libraries that mistakenly spew output at INFO should be turned down by default

Configuration

To set the global logging level to something other than info, use:

config.logging.level = "WARN"

To enable loggly, set its token and configure an environment name:

config.logging.loggly.token = "LOGGLY_TOKEN"
config.logging.loggly.environment = "ENVIRONMENT_NAME"

To disable loggly unconditionally:

config.logging.loggly.enabled = False

To tune the logging levels of third-party components:

config.logging.loggly.levels.override.warn = ["foo", "bar"]