feat: make log level configurable#26
Open
westbrook-ai wants to merge 2 commits into
Open
Conversation
The service previously hard-coded the loguru sink at DEBUG, producing noisy output in production with no way to dial it down. Add a TERMINALS_LOG_LEVEL setting (default INFO) that controls the loguru sink level in the API service and the stdlib/kopf log level in the operator. Invalid values fall back to INFO with a warning. Closes open-webui#21
15ef4b0 to
445db92
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
TERMINALS_LOG_LEVELenvironment 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 toINFO.Changes
terminals/config.py— newlog_levelsetting (TERMINALS_LOG_LEVEL, defaultINFO).terminals/logging.py— the loguru sink now uses the configured level. Invalid values fall back toINFOwith a warning. Thelevel=0stdlib 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.
WARNINGsuppressesDEBUG/INFO), and that an invalid value (e.g.bogus) falls back toINFOwith a warning. No automated test suite is present in the repo.