You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to understand how to read contextualized values within the do_something() function when using the logger.contextualize() method. Here is an example of my code:
from loguru import logger
task_id = "12345"
def do_something():
# How can I access the contextualized 'task' value here?
logger.info("Doing something")
with logger.contextualize(task=task_id):
do_something()
logger.info("End of task")
The text was updated successfully, but these errors were encountered:
I understand that the logger is primarily intended to provide context to logged messages rather than storing or accessing values. I'll explore using contextvars directly for managing contextual values.
Hello,
I'm trying to understand how to read contextualized values within the do_something() function when using the logger.contextualize() method. Here is an example of my code:
The text was updated successfully, but these errors were encountered: