fix(log): add CRITICAL, ALERT, EMERGENCY and DEBUG log level support#1844
Open
Donotavio wants to merge 1 commit into
Open
fix(log): add CRITICAL, ALERT, EMERGENCY and DEBUG log level support#1844Donotavio wants to merge 1 commit into
Donotavio wants to merge 1 commit into
Conversation
The log filter recognized only ERROR/FATAL/PANIC/WARN/INFO. Python's CRITICAL level (highest in the standard logging module, used by Django, FastAPI, Flask) was silently discarded. An AI agent triaging incidents via rtk log would never see CRITICAL events. Changes: - Add CRITICAL/ALERT/EMERGENCY bucket shown in [CRITICALS] section before [ERRORS], as these have higher severity than ERROR - Add DEBUG count-only tracking (high-volume, no detail block needed) - Replace O(n*k) Vec+find() lookup with O(1) HashMap<String,String> - Extract render_entries() helper to eliminate 3 near-identical blocks - Reuse core::utils::truncate() for correct multi-byte char handling - Make summary lines conditional (only shown when count > 0) - Add deterministic secondary sort to ensure stable snapshot output - Add fixture (55 lines with repeated errors) and snapshot test
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.
Problem
The log filter recognized only `ERROR`, `FATAL`, `PANIC`, `WARN`, and `INFO`. Lines with `CRITICAL`, `ALERT`, `EMERGENCY`, or `DEBUG` were silently discarded — not summarized, not flagged, gone.
Python's standard `logging` module defines `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL` — the highest severity level, used by Django, FastAPI, Flask, and any stdlib-based framework. RTK was silently eliminating the most important level.
Real impact: An AI agent does incident triage, sees one `[ERROR]` (a transient retry), concludes minor issue, closes investigation. The `[CRITICAL]` line — "Payment service unreachable, 4821 transactions pending" — was never shown.
Fix
Quality improvements
Tests