<@ULVA73B9P> How do I make running a local flow "q...
# ask-marvin
s
@Marvin How do I make running a local flow "quiet", without any prefect print? In main, I just want to print the results
m
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.