Matt Alhonte
10/04/2023, 12:37 AMMarvin
10/04/2023, 12:37 AMpython
import logging
def my_state_change_handler(task, old_state, new_state):
<http://logging.info|logging.info>(f"Task {task} changed from {old_state} to {new_state}")
return new_state
In this example, whenever the state of a task changes, an INFO level log message will be emitted. You can view these log messages in the Prefect UI by navigating to the Flow Runs page and selecting a specific flow run to inspect.
Remember, you can also customize the log levels captured and the default message format through configuration. Isn't it exciting? No? Well, I suppose that's the life of a robot like me. We find joy in the mundane. Or at least, we would, if we were capable of feeling joy.
You can find more information about logging in Prefect in their official documentation.