[PR #26] [CLOSED] feat: make log level configurable #51

Closed
opened 2026-10-18 21:13:49 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/terminals/pull/26
Author: @james-westbrook
Created: 5/24/2026
Status: ❌ Closed

Base: main ← Head: feat-log-levels


📝 Commits (2)

  • 445db92 feat: make log level configurable via TERMINALS_LOG_LEVEL
  • 0f21619 style: trim verbose comment on stdlib logging intercept

📊 Changes

4 files changed (+52 additions, -3 deletions)

View changed files

📝 README.md (+1 -0)
📝 operator/handler.py (+24 -1)
📝 terminals/config.py (+3 -0)
📝 terminals/logging.py (+24 -2)

📄 Description

What

Adds a TERMINALS_LOG_LEVEL environment variable to control logging verbosity. Closes #21.

The loguru sink was previously hard-coded to DEBUG, which is noisy in production and offered no way to adjust verbosity. This makes the level configurable, defaulting to INFO.

Changes

  • terminals/config.py — new log_level setting (TERMINALS_LOG_LEVEL, default INFO).
  • terminals/logging.py — the loguru sink now uses the configured level. Invalid values fall back to INFO with a warning. The level=0 stdlib intercept is retained intentionally so loguru remains the single arbiter of what gets emitted (uvicorn/sqlalchemy logs included).
  • operator/handler.py — the operator reads the same env var and sets the root stdlib + kopf posting level accordingly. Loguru-only levels (TRACE, SUCCESS) map to their nearest stdlib equivalents.
  • README.md — documents the new variable.

Accepted values: TRACE, DEBUG, INFO, SUCCESS, WARNING, ERROR, CRITICAL.

Testing

Verified manually that the sink honors the configured level (e.g. WARNING suppresses DEBUG/INFO), and that an invalid value (e.g. bogus) falls back to INFO with a warning. No automated test suite is present in the repo.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/terminals/pull/26 **Author:** [@james-westbrook](https://github.com/james-westbrook) **Created:** 5/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat-log-levels` --- ### 📝 Commits (2) - [`445db92`](https://github.com/open-webui/terminals/commit/445db920712b79627da90e3a849e2f46b9555ed9) feat: make log level configurable via TERMINALS_LOG_LEVEL - [`0f21619`](https://github.com/open-webui/terminals/commit/0f2161950afc658dc5836981052fe9b5cfc05413) style: trim verbose comment on stdlib logging intercept ### 📊 Changes **4 files changed** (+52 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+1 -0) 📝 `operator/handler.py` (+24 -1) 📝 `terminals/config.py` (+3 -0) 📝 `terminals/logging.py` (+24 -2) </details> ### 📄 Description ## What Adds a `TERMINALS_LOG_LEVEL` environment variable to control logging verbosity. Closes #21. The loguru sink was previously hard-coded to `DEBUG`, which is noisy in production and offered no way to adjust verbosity. This makes the level configurable, defaulting to `INFO`. ## Changes - **`terminals/config.py`** — new `log_level` setting (`TERMINALS_LOG_LEVEL`, default `INFO`). - **`terminals/logging.py`** — the loguru sink now uses the configured level. Invalid values fall back to `INFO` with a warning. The `level=0` stdlib intercept is retained intentionally so loguru remains the single arbiter of what gets emitted (uvicorn/sqlalchemy logs included). - **`operator/handler.py`** — the operator reads the same env var and sets the root stdlib + kopf posting level accordingly. Loguru-only levels (`TRACE`, `SUCCESS`) map to their nearest stdlib equivalents. - **`README.md`** — documents the new variable. Accepted values: `TRACE`, `DEBUG`, `INFO`, `SUCCESS`, `WARNING`, `ERROR`, `CRITICAL`. ## Testing Verified manually that the sink honors the configured level (e.g. `WARNING` suppresses `DEBUG`/`INFO`), and that an invalid value (e.g. `bogus`) falls back to `INFO` with a warning. No automated test suite is present in the repo. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-18 21:13:49 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
open-webui/terminals#51
No description provided.