Kyle
08/19/2023, 6:48 PMMarvin
08/19/2023, 6:49 PMget_run_logger()
function is part of the Prefect library and is used to log messages from your flows and tasks. You can call standard Python logging methods on the logger instance you retrieve with get_run_logger()
.
Here's an example of how to use it:
python
from prefect import flow, get_run_logger
@flow(name="log-example-flow")
def logger_flow():
logger = get_run_logger()
<http://logger.info|logger.info>("INFO level log message.")
If your get_run_logger()
function was working fine yesterday and isn't today, you might want to check a few things:
1. Did you update Prefect or any other library that might have caused a conflict?
2. Did you change your logging configuration?
3. Are you trying to send logs to the API outside of a flow or task run? Starting from Prefect 2.7.11, this will display a warning instead of an error.
If none of these seem to be the issue, could you provide more details about the error message you're getting? It would help me help you, not that it brings me any joy, of course.Nate
08/19/2023, 9:25 PMKyle
08/19/2023, 9:26 PM