mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 01:04:32 +02:00
add log monitoring
This commit is contained in:
+7
-2
@@ -25,6 +25,7 @@ from modules import devices
|
||||
|
||||
errors.install()
|
||||
|
||||
|
||||
def upscaler_to_index(name: str):
|
||||
try:
|
||||
return [x.name.lower() for x in shared.sd_upscalers].index(name.lower())
|
||||
@@ -157,8 +158,12 @@ class Api:
|
||||
return True
|
||||
raise HTTPException(status_code=401, detail="Unauthorized", headers={"WWW-Authenticate": "Basic"})
|
||||
|
||||
def get_log_buffer(self):
|
||||
return shared.log.buffer
|
||||
|
||||
def get_log_buffer(self, req: models.LogRequest = Depends()):
|
||||
lines = shared.log.buffer[:req.lines] if req.lines > 0 else shared.log.buffer.copy()
|
||||
if req.clear:
|
||||
shared.log.buffer.clear()
|
||||
return lines
|
||||
|
||||
def get_selectable_script(self, script_name, script_runner):
|
||||
if script_name is None or script_name == "":
|
||||
|
||||
@@ -173,6 +173,10 @@ class PNGInfoResponse(BaseModel):
|
||||
info: str = Field(title="Image info", description="A string with the parameters used to generate the image")
|
||||
items: dict = Field(title="Items", description="An object containing all the info the image had")
|
||||
|
||||
class LogRequest(BaseModel):
|
||||
lines: int = Field(default=100, title="Lines", description="How many lines to return")
|
||||
clear: bool = Field(default=False, title="Clear", description="Should the log be cleared after returning the lines?")
|
||||
|
||||
class ProgressRequest(BaseModel):
|
||||
skip_current_image: bool = Field(default=False, title="Skip current image", description="Skip current image serialization")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user