mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
log handlers: rotate and ring buffer
This commit is contained in:
@@ -142,6 +142,7 @@ class Api:
|
||||
self.add_api_route("/sdapi/v1/reload-checkpoint", self.reloadapi, methods=["POST"])
|
||||
self.add_api_route("/sdapi/v1/scripts", self.get_scripts_list, methods=["GET"], response_model=models.ScriptsList)
|
||||
self.add_api_route("/sdapi/v1/script-info", self.get_script_info, methods=["GET"], response_model=List[models.ScriptInfo])
|
||||
self.add_api_route("/sdapi/v1/log", self.get_log_buffer, methods=["GET"], response_model=List)
|
||||
self.default_script_arg_txt2img = []
|
||||
self.default_script_arg_img2img = []
|
||||
|
||||
@@ -156,6 +157,9 @@ 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_selectable_script(self, script_name, script_runner):
|
||||
if script_name is None or script_name == "":
|
||||
return None, None
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ def install(suppress=[]): # noqa: B006
|
||||
warnings.filterwarnings("ignore", category=UserWarning)
|
||||
pretty_install(console=console)
|
||||
traceback_install(console=console, extra_lines=1, width=console.width, word_wrap=False, indent_guides=False, suppress=suppress)
|
||||
logging.basicConfig(level=logging.INFO, format='%(asctime)s | %(levelname)s | %(pathname)s | %(message)s')
|
||||
logging.basicConfig(level=logging.ERROR, format='%(asctime)s | %(levelname)s | %(pathname)s | %(message)s')
|
||||
# for handler in logging.getLogger().handlers:
|
||||
# handler.setLevel(logging.INFO)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user