Logging: suprress sample/reference_tools and sample/spreadsheet success messages but keep failures. Should be disabled when debugging.
This commit is contained in:
@@ -27,9 +27,15 @@ class QtLogHandler(logging.Handler):
|
||||
class IgnoreSuccessfulStatusAccessFilter(logging.Filter):
|
||||
#Should be disabled if debugging status calls.
|
||||
#In particular if this is causing server/GUI lag
|
||||
_SUPPRESSED_SUCCESS_MESSAGES = (
|
||||
'"GET /status HTTP/1.1" 200',
|
||||
'"GET /sample/reference_tools HTTP/1.1" 200',
|
||||
'"GET /sample/spreadsheet HTTP/1.1" 200',
|
||||
)
|
||||
|
||||
def filter(self, record: logging.LogRecord) -> bool:
|
||||
message = record.getMessage()
|
||||
return not ('"GET /status HTTP/1.1" 200' in message)
|
||||
return not any(entry in message for entry in self._SUPPRESSED_SUCCESS_MESSAGES)
|
||||
|
||||
|
||||
def get_uvicorn_logging_config() -> dict:
|
||||
|
||||
Reference in New Issue
Block a user