mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-03-26 23:06:45 +01:00
Don't log /ping healthcheck requests
This commit is contained in:
parent
dc9f6013e8
commit
6efbe62dca
@ -14,6 +14,7 @@ OUTPUT_DIRNAME = "Stable Diffusion UI" # in the user's home folder
|
||||
from fastapi import FastAPI, HTTPException
|
||||
from starlette.responses import FileResponse
|
||||
from pydantic import BaseModel
|
||||
import logging
|
||||
|
||||
from sd_internal import Request, Response
|
||||
|
||||
@ -116,5 +117,12 @@ def read_modifiers():
|
||||
def read_home_dir():
|
||||
return {outpath}
|
||||
|
||||
# don't log /ping requests
|
||||
class HealthCheckLogFilter(logging.Filter):
|
||||
def filter(self, record: logging.LogRecord) -> bool:
|
||||
return record.getMessage().find('/ping') == -1
|
||||
|
||||
logging.getLogger('uvicorn.access').addFilter(HealthCheckLogFilter())
|
||||
|
||||
# start the browser ui
|
||||
import webbrowser; webbrowser.open('http://localhost:9000')
|
||||
|
Loading…
Reference in New Issue
Block a user