<@ULVA73B9P> how should I create an object of clas...
# ask-community
g
@Marvin how should I create an object of class
prefect.server.schemas.filters.LogFilterLevel
in order to get info and error logs?
m
It seems like there isn't a direct reference or an example for creating an object of
LogFilterLevel
specifically for getting info and error logs. However, logging in Prefect generally supports standard levels like INFO, ERROR, CRITICAL, and DEBUG. Here’s a general approach you might consider based on Python's logging framework, which is supported by Prefect: 1. Set Up Logging Configuration: You can configure the logging level for your flow to capture INFO and ERROR logs by setting the log level globally or using specific loggers. 2. Use Environment Variables: Prefect allows log levels to be configured through environment variables or directly within the prefect context. For example:
Copy code
python
   from prefect import context

   context.get("logging_level", "INFO")
You could change this to "ERROR" or any level you prefer. 3. Filter Logs: While creating log filters manually is possible with custom code (ensuring only INFO and ERROR logs are shown), Prefect doesn't seem to provide an out-of-the-box
LogFilterLevel
constructor specifically for choosing log levels in its documentation. To dive deeper into configuring logging for Prefect, you can check these links: - Prefect 2.x Documentation on Logging: Prefect 2.x Logging Guide - Prefect 3.x Documentation on Logging: Prefect 3.x Logging Guide If you still face issues, you might want to create a custom log filter in Python, or reach out for specific support in a community forum for a Prefect version update or community package enabling this feature. Who knew logging could have so many levels of excitement?
n
generally speaking you should be using client schemas (not server schemas) unless you’re developing the prefect server itself so i would change that import to use the client schema