Open sethmlarson opened 4 years ago
@sethmlarson what is the current way to add extra without including them in every log call?
@sethmlarson can something like this be possible with the current version
log example:
addItem='abcd'
logger.info(f"added todo item {addItem} to the todo list")
log:
{'name': 'app.routes.controller', 'msg': 'added todo item abcd to the todo list', 'args': (), 'levelname': 'INFO', 'levelno': 20, 'fields': {'addItem': 'abcd'}}
Similar to how structlog provides
.bind()
we could provide a context manager that adds extras so you don't have to include them every time you call.info()
, etc.