Skip to content

Commit

Permalink
fix: 🚑️ set debug level from endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
melMass committed Jul 21, 2023
1 parent 4d8ddac commit 18402e3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,10 @@ def load_nodes():

# - ENDPOINT
from server import PromptServer
from .log import mklog
from .log import mklog, log
from aiohttp import web
from importlib import reload
import logging

endlog = mklog("endpoint")

Expand All @@ -164,10 +165,15 @@ async def set_debug(request):
enabled = json_data.get("enabled")
if enabled:
os.environ["MTB_DEBUG"] = "true"
log.setLevel(logging.DEBUG)
log.debug("Debug mode set")

else:
if "MTB_DEBUG" in os.environ:
# del os.environ["MTB_DEBUG"]
os.environ.pop("MTB_DEBUG")
log.setLevel(logging.INFO)

return web.json_response({"message": f"Debug mode {'set' if enabled else 'unset'}"})


Expand Down

0 comments on commit 18402e3

Please sign in to comment.