feat(logging): implement configurable belief state logging
- Add LoggingConfig model and logging field to GlobalSettings - Implement belief_scope context manager for structured logging - Add configure_logger for dynamic level and file rotation settings - Add logging configuration UI to Settings page - Update ConfigManager to apply logging settings on initialization and updates
This commit is contained in:
@@ -2,19 +2,19 @@
|
||||
|
||||
**Spec**: `specs/006-configurable-belief-logs/spec.md`
|
||||
**Plan**: `specs/006-configurable-belief-logs/plan.md`
|
||||
**Status**: Pending
|
||||
**Status**: Completed
|
||||
|
||||
## Phase 1: Setup
|
||||
*Goal: Initialize project structure for logging.*
|
||||
|
||||
- [ ] T001 Ensure logs directory exists at `logs/` (relative to project root)
|
||||
- [x] T001 Ensure logs directory exists at `logs/` (relative to project root)
|
||||
|
||||
## Phase 2: Foundational
|
||||
*Goal: Define data models and infrastructure required for logging configuration.*
|
||||
|
||||
- [ ] T002 Define `LoggingConfig` model in `backend/src/core/config_models.py`
|
||||
- [ ] T003 Update `GlobalSettings` model to include `logging` field in `backend/src/core/config_models.py`
|
||||
- [ ] T004 Update `ConfigManager` to handle logging configuration persistence in `backend/src/core/config_manager.py`
|
||||
- [x] T002 Define `LoggingConfig` model in `backend/src/core/config_models.py`
|
||||
- [x] T003 Update `GlobalSettings` model to include `logging` field in `backend/src/core/config_models.py`
|
||||
- [x] T004 Update `ConfigManager` to handle logging configuration persistence in `backend/src/core/config_manager.py`
|
||||
|
||||
## Phase 3: User Story 1 - Structured Belief State Logging
|
||||
*Goal: Implement the core "Belief State" logging logic with context managers.*
|
||||
@@ -22,9 +22,9 @@
|
||||
|
||||
**Independent Test**: Run `pytest backend/tests/test_logger.py` and verify `belief_scope` generates `[ID][Entry]`, `[ID][Action]`, and `[ID][Exit]` logs.
|
||||
|
||||
- [ ] T005 [US1] Create unit tests for belief state logging in `backend/tests/test_logger.py`
|
||||
- [ ] T006 [US1] Implement `belief_scope` context manager in `backend/src/core/logger.py`
|
||||
- [ ] T007 [US1] Implement log formatting and smart filtering (suppress Entry/Exit if disabled) in `backend/src/core/logger.py`
|
||||
- [x] T005 [US1] Create unit tests for belief state logging in `backend/tests/test_logger.py`
|
||||
- [x] T006 [US1] Implement `belief_scope` context manager in `backend/src/core/logger.py`
|
||||
- [x] T007 [US1] Implement log formatting and smart filtering (suppress Entry/Exit if disabled) in `backend/src/core/logger.py`
|
||||
|
||||
## Phase 4: User Story 2 - Configurable Logging Settings
|
||||
*Goal: Expose logging configuration to the user via API and UI.*
|
||||
@@ -32,15 +32,15 @@
|
||||
|
||||
**Independent Test**: Update settings via API/UI and verify log level changes (e.g., DEBUG logs appear) and file rotation is active.
|
||||
|
||||
- [ ] T008 [US2] Implement `configure_logger` function to apply settings (level, file, rotation) in `backend/src/core/logger.py`
|
||||
- [ ] T009 [US2] Update settings API endpoint to handle `logging` updates in `backend/src/api/routes/settings.py`
|
||||
- [ ] T010 [P] [US2] Add Logging configuration section (Level, File Path, Enable Belief State) to `frontend/src/pages/Settings.svelte`
|
||||
- [x] T008 [US2] Implement `configure_logger` function to apply settings (level, file, rotation) in `backend/src/core/logger.py`
|
||||
- [x] T009 [US2] Update settings API endpoint to handle `logging` updates in `backend/src/api/routes/settings.py`
|
||||
- [x] T010 [P] [US2] Add Logging configuration section (Level, File Path, Enable Belief State) to `frontend/src/pages/Settings.svelte`
|
||||
|
||||
## Final Phase: Polish & Cross-Cutting Concerns
|
||||
*Goal: Verify system stability and cleanup.*
|
||||
|
||||
- [ ] T011 Verify log rotation works by generating dummy logs (manual verification)
|
||||
- [ ] T012 Ensure default configuration provides a sensible out-of-the-box experience
|
||||
- [x] T011 Verify log rotation works by generating dummy logs (manual verification)
|
||||
- [x] T012 Ensure default configuration provides a sensible out-of-the-box experience
|
||||
|
||||
## Dependencies
|
||||
|
||||
|
||||
Reference in New Issue
Block a user