forked from open-webui/open-webui
Improve logging. Move print()
statements to appropiate log()
.
Add COMFYUI and WEBHOOK logging and associated environment variable control. Add WEBHOOK payload & request debug logs.
This commit is contained in:
parent
1d7ca44017
commit
144c9059a3
6 changed files with 31 additions and 16 deletions
|
@ -1,6 +1,11 @@
|
|||
import json
|
||||
import requests
|
||||
from config import VERSION, WEBUI_FAVICON_URL, WEBUI_NAME
|
||||
import logging
|
||||
|
||||
from config import SRC_LOG_LEVELS, VERSION, WEBUI_FAVICON_URL, WEBUI_NAME
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
log.setLevel(SRC_LOG_LEVELS["WEBHOOK"])
|
||||
|
||||
|
||||
def post_webhook(url: str, message: str, event_data: dict) -> bool:
|
||||
|
@ -39,9 +44,11 @@ def post_webhook(url: str, message: str, event_data: dict) -> bool:
|
|||
else:
|
||||
payload = {**event_data}
|
||||
|
||||
log.debug(f"payload: {payload}")
|
||||
r = requests.post(url, json=payload)
|
||||
r.raise_for_status()
|
||||
log.debug(f"r.text: {r.text}")
|
||||
return True
|
||||
except Exception as e:
|
||||
print(e)
|
||||
log.exception(e)
|
||||
return False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue