Skip to main content

logbind

Project description

https://travis-ci.org/cjrh/logbind.svg?branch=master https://coveralls.io/repos/github/cjrh/logbind/badge.svg?branch=master https://img.shields.io/pypi/pyversions/logbind.svg https://img.shields.io/github/tag/cjrh/logbind.svg https://img.shields.io/badge/install-pip%20install%20logbind-ff69b4.svg https://img.shields.io/pypi/v/logbind.svg https://img.shields.io/badge/calver-YYYY.MM.MINOR-22bfda.svg

logbind

Easily bind new fields into your logger instances.

# Original logger
logger = logging.getLogger('a')
logger.info('Hello')

logger = logbind.bind(logger, id=12345)
logger.info('Hello')  # <- This logrecord has an extra field "id"

logger = logbind.bind(logger, abc=67890)
logger.info('Hello')  # <- logrecord has two extra fields: "id" and "abc"

This feature will be most useful with a structured logging formatter, such as JSON. You could try logjson for example.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

logbind-2017.11.7.tar.gz (7.7 kB view hashes)

Uploaded source

Built Distribution

logbind-2017.11.7-py2.py3-none-any.whl (13.7 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page