[2026-02-07] Fix: Dev Logging Suppression in Production Builds
Task Metadata
Date: 2026-02-07
Status: Complete
- Beads Issue: (To be created)
Objective
Goal: Ensure diagnostic logs are visible in the Amplify dev deployment by making the logging level configurable via environment variables.
- Trigger: Logs are currently missing in the Vite
devdeployment becauseimport.meta.env.PRODis true for all builds, causinglogger.tsto default towarnlevel. - Constraints: Must not expose debug logs in the production environment (
chatkcal.app).
Technical Strategy
Introduce a VITE_LOG_LEVEL environment variable that overrides the default production suppression.
- Key Decisions:
- Add
VITE_LOG_LEVEL=debugtofrontend/.env.dev. - Update
frontend/src/utils/logger.tsto checkimport.meta.env.VITE_LOG_LEVELbefore falling back toPRODlogic.
- Add
Testing Strategy
- Must Test: Verify logs appear in local development.
- Skip: Manual verification on Amplify (requires deployment).
Risk Analysis
- Potential Regressions: None.
- Security Implications: Debug logs might leak non-sensitive metadata if incorrectly enabled in production.
- Files to Modify:
frontend/.env.devfrontend/src/utils/logger.tsdocs/architecture/testing_strategy.md(Update observability section)
Execution Plan
- Step 1: Add
VITE_LOG_LEVEL=debugtofrontend/.env.dev. - Step 2: Update
frontend/src/utils/logger.tsto respect the new environment variable. - Step 3: Update
docs/architecture/testing_strategy.mdto document the observability/logging configuration. - Verify: Check local console for
[ChatKcal]prefixed debug logs.
Execution Notes
- Implemented in frontend runtime/config:
frontend/.env.devnow setsVITE_LOG_LEVEL=debug.frontend/src/utils/logger.tsnow prioritizesVITE_LOG_LEVELbeforeimport.meta.env.PRODfallback.
- Documentation updated:
docs/architecture/testing_strategy.mdnow documents the observability/log-level control strategy.
- Validation:
- Verified debug-stage logs in
usePromotiontest output ([ChatKcal]stage transitions and outcomes).
- Verified debug-stage logs in
User Approval & Key Learnings
Key Learnings
- Production build mode (
import.meta.env.PROD) is insufficient as a proxy for environment intent in multi-env deployments. - Explicit log-level env overrides are safer and easier to audit.
(User to confirm approval and add notes/learnings)
Context Memory (AI-Only)
Summary for Future Context
Fixing log suppression in dev builds by introducing VITE_LOG_LEVEL env var support in the frontend logger.