Enable INFO logs for ag_ui_agentspec and pyagentspec and attach a console handler. Uvicorn's default logging config doesn't automatically show 3rd‑party logger output. We install a root handler and set levels explicitly so logs appear in the terminal.
()
| 1 | import logging |
| 2 | |
| 3 | def configure_logging() -> None: |
| 4 | """Enable INFO logs for ag_ui_agentspec and pyagentspec and attach a console handler. |
| 5 | |
| 6 | Uvicorn's default logging config doesn't automatically show 3rd‑party logger output. |
| 7 | We install a root handler and set levels explicitly so logs appear in the terminal. |
| 8 | """ |
| 9 | root = logging.getLogger() |
| 10 | if not root.handlers: |
| 11 | handler = logging.StreamHandler() |
| 12 | handler.setFormatter(logging.Formatter("%(asctime)s | %(levelname)s | %(name)s | %(message)s")) |
| 13 | root.addHandler(handler) |
| 14 | root.setLevel(logging.INFO) |
| 15 | for h in root.handlers: |
| 16 | try: |
| 17 | h.setLevel(logging.INFO) |
| 18 | except Exception: |
| 19 | pass |
| 20 | |
| 21 | # Turn on INFO for relevant namespaces and propagate to root |
| 22 | for name in ( |
| 23 | "ag_ui_agentspec", |
| 24 | "ag_ui_agentspec.endpoint", |
| 25 | "ag_ui_agentspec.tracing", |
| 26 | "pyagentspec", |
| 27 | "wayflowcore", |
| 28 | ): |
| 29 | lg = logging.getLogger(name) |
| 30 | lg.setLevel(logging.INFO) |
| 31 | lg.propagate = True |
| 32 | |
| 33 | # Also make uvicorn loggers propagate to our root handler |
| 34 | for name in ("uvicorn", "uvicorn.error", "uvicorn.access"): |
| 35 | lg = logging.getLogger(name) |
| 36 | lg.setLevel(logging.INFO) |
| 37 | lg.propagate = True |