John Ramey
03/24/2022, 8:54 PMprefect.context.get("logger")
. Does a logger have to be defined within each task? This gets a bit repetitive if I have 5-10 tasks within a flow. Is there a more concise way to define loggers across tasks?
import prefect
@task
def my_task():
logger = prefect.context.get("logger")
<http://logger.info|logger.info>("An info message.")
logger.warning("A warning message.")
Kevin Kho
03/24/2022, 9:12 PMJohn Ramey
03/24/2022, 9:15 PMlogger = prefect.context.get("logger")
to the top to make it global. it just worked across all the tasksKevin Kho
03/24/2022, 9:16 PM@task(log_stdout=True)
def some_task():
print("something")
and I think it should workJohn Ramey
03/24/2022, 9:16 PM