Skip to content
Opinionated logging configuration
Branch: develop
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
.globality
build.python-library/docker-base
microcosm_logging Modernize Feb 20, 2019
.ackrc
.bumpversion.cfg
.dockerignore
.gitignore
CONTRIBUTING.md
Dockerfile.template
LICENSE
MANIFEST.in
README.md
entrypoint.sh
setup.cfg
setup.py
tox.ini

README.md

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"]
You can’t perform that action at this time.