You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by gs...@apache.org on 2026/09/20 08:57:05 UTC

(tooling-llmao) branch main updated: Quiet down DEBUG messages in ASGI mode.

This is an automated email from the ASF dual-hosted git repository.

gstein pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-llmao.git


The following commit(s) were added to refs/heads/main by this push:
     new 33a4073  Quiet down DEBUG messages in ASGI mode.
33a4073 is described below

commit 33a407309bbb8c8036f025285c928e2818565936
Author: Greg Stein <gs...@gmail.com>
AuthorDate: Sun Sep 20 03:56:56 2026 -0500

    Quiet down DEBUG messages in ASGI mode.
---
 main.py | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/main.py b/main.py
index 1cfc27b..a57dad6 100644
--- a/main.py
+++ b/main.py
@@ -128,8 +128,9 @@ def create_app():
     return app
 
 
-def run_standalone() -> None:
-    """Run as a standalone server (asfquart runx + optional TLS)."""
+def _configure_logging():
+
+    # NOTE: no-op if Hypercorn has set up the root logger.
     logging.basicConfig(
         level=logging.DEBUG,
         style="{",
@@ -137,6 +138,7 @@ def run_standalone() -> None:
         datefmt=DATE_FORMAT,
     )
 
+    # We don't want DEBUG messages from these modules.
     for modname in {
         "selector_events",
         "hpack",
@@ -144,9 +146,18 @@ def run_standalone() -> None:
         "asyncio",
         "httpcore.http11",
         "httpcore.connection",
+        "watchfiles.main",
     }:
         logging.getLogger(modname).setLevel(logging.INFO)
 
+    # Regardless of the root logger, use DEBUG for this module.
+    _LOGGER.setLevel(logging.DEBUG)
+
+
+def run_standalone() -> None:
+    """Run as a standalone server (asfquart runx + optional TLS)."""
+
+    _configure_logging()
     _LOGGER.info(" ** Run-mode: Standalone")
 
     if not (THIS_DIR / "config.yaml").is_file():
@@ -186,16 +197,8 @@ def run_standalone() -> None:
 
 def run_asgi() -> None:
     """Run as an ASGI process (e.g. Hypercorn imports main:llmao_app)."""
-    # NOTE: no-op if Hypercorn has set up the root logger.
-    logging.basicConfig(
-        level=logging.DEBUG,
-        style="{",
-        format="[{asctime}|{levelname}|{name}] {message}",
-        datefmt=DATE_FORMAT,
-    )
-    logging.getLogger("watchfiles.main").setLevel(logging.INFO)
-    _LOGGER.setLevel(logging.DEBUG)
 
+    _configure_logging()
     _LOGGER.info(" ** Run-mode: ASGI")
 
     global llmao_app


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org