@Marvin How do I make running a local flow "quiet", without any prefect print? In main, I just want to print the results
m
Marvin
03/10/2025, 5:42 PM
To suppress Prefect's logging output when running a local flow, you can adjust the logging level. Prefect uses Python's logging module, so you can set the logging level to a higher threshold (e.g.,
WARNING
or
ERROR
) to suppress
INFO
and
DEBUG
messages. Here's a concise way to do it:
Copy code
python
import logging
from prefect import flow
# Set the logging level to WARNING to suppress lower level logs
logging.getLogger("prefect").setLevel(logging.WARNING)
@flow
def my_flow():
return "Flow result"
if __name__ == "__main__":
result = my_flow()
print(result)
This will ensure that only warnings and errors are printed, allowing you to focus on the flow's result.
For more information on configuring logging in Prefect, you can refer to the Prefect logging documentation.
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.