[PR #423] Refactor logging suppression with policy overrides and feature-gated video filter #729

Open
opened 2026-03-13 21:06:09 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/AJaySi/ALwrity/pull/423
Author: @AJaySi
Created: 3/12/2026
Status: 🔄 Open

Base: mainHead: codex/refactor-logging-suppression-logic


📝 Commits (1)

  • c1d4b86 Refactor backend logging suppression policies

📊 Changes

1 file changed (+128 additions, -87 deletions)

View changed files

📝 backend/logging_config.py (+128 -87)

📄 Description

Motivation

  • Consolidate scattered logger suppression into a declarative, maintainable policy set to make suppression behavior easier to reason about and extend.
  • Allow runtime overrides of logger levels via an environment variable so operators can relax or tighten specific loggers without changing code by using ALWRITY_LOG_LEVEL_OVERRIDES.
  • Keep the Story Video focused INFO sink but make it opt-in behind a clear feature flag to avoid surprising console output by default via ALWRITY_ENABLE_STORY_VIDEO_LOG_FILTER.

Description

  • Documented the override format in the module docstring and added support for comma-separated module=LEVEL overrides via ALWRITY_LOG_LEVEL_OVERRIDES.
  • Introduced DEFAULT_NAMESPACE_LEVEL_POLICIES and a NOISY_LOGGERS list and consolidated suppression into _build_logger_level_policies() and _apply_logger_level_policies() to apply levels programmatically.
  • Added parsing and deduplication logic in _parse_log_level_overrides() where the last duplicate wins and invalid entries are ignored, and unified boolean env parsing in _is_enabled() which is used in setup_clean_logging() and get_uvicorn_log_level().
  • Moved the Story Video generation sink behind the feature flag ALWRITY_ENABLE_STORY_VIDEO_LOG_FILTER so it is only registered when explicitly enabled.

Testing

  • Ran python -m py_compile backend/logging_config.py to verify the module compiles successfully (passed).

Codex Task


🔄 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/AJaySi/ALwrity/pull/423 **Author:** [@AJaySi](https://github.com/AJaySi) **Created:** 3/12/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `codex/refactor-logging-suppression-logic` --- ### 📝 Commits (1) - [`c1d4b86`](https://github.com/AJaySi/ALwrity/commit/c1d4b86c749ff1b6fb0baf21d55d5e3897871f63) Refactor backend logging suppression policies ### 📊 Changes **1 file changed** (+128 additions, -87 deletions) <details> <summary>View changed files</summary> 📝 `backend/logging_config.py` (+128 -87) </details> ### 📄 Description ### Motivation - Consolidate scattered logger suppression into a declarative, maintainable policy set to make suppression behavior easier to reason about and extend. - Allow runtime overrides of logger levels via an environment variable so operators can relax or tighten specific loggers without changing code by using `ALWRITY_LOG_LEVEL_OVERRIDES`. - Keep the Story Video focused INFO sink but make it opt-in behind a clear feature flag to avoid surprising console output by default via `ALWRITY_ENABLE_STORY_VIDEO_LOG_FILTER`. ### Description - Documented the override format in the module docstring and added support for comma-separated `module=LEVEL` overrides via `ALWRITY_LOG_LEVEL_OVERRIDES`. - Introduced `DEFAULT_NAMESPACE_LEVEL_POLICIES` and a `NOISY_LOGGERS` list and consolidated suppression into `_build_logger_level_policies()` and `_apply_logger_level_policies()` to apply levels programmatically. - Added parsing and deduplication logic in `_parse_log_level_overrides()` where the last duplicate wins and invalid entries are ignored, and unified boolean env parsing in `_is_enabled()` which is used in `setup_clean_logging()` and `get_uvicorn_log_level()`. - Moved the Story Video generation sink behind the feature flag `ALWRITY_ENABLE_STORY_VIDEO_LOG_FILTER` so it is only registered when explicitly enabled. ### Testing - Ran `python -m py_compile backend/logging_config.py` to verify the module compiles successfully (passed). ------ [Codex Task](https://chatgpt.com/codex/tasks/task_e_69b1467e0e18832885be8b8d156c26fc) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
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
starred/ALwrity#729
No description provided.