Skip to content
/ logbind Public

Easily bind new LogRecord fields into your logger instances.

License

Notifications You must be signed in to change notification settings

cjrh/logbind

Repository files navigation

https://travis-ci.org/cjrh/logbind.svg?branch=master https://coveralls.io/repos/github/cjrh/logbind/badge.svg?branch=master

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.

About

Easily bind new LogRecord fields into your logger instances.

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages