feat: reorder log format to level-context-message#11
Conversation
📝 WalkthroughWalkthroughThe ColoredLevelFormatter's format method was changed to attach object context as a ChangesLog formatting update
Estimated code review effort: 1 (Trivial) | ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/gooddata_legacy2cloud/logging/config.py (1)
43-43: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueFormat string tightly coupled to
ColoredLevelFormatter.The literal
%(context_str)stoken only resolves correctly becauseColoredLevelFormatter.format()always setsrecord.context_strfirst. If this template string is ever reused with a plainlogging.Formatter(or any formatter that doesn't setcontext_str), it will raiseKeyErrorat format time. Not an issue today since both live together inconfigure_logger, but worth a short comment noting this coupling for future maintainers.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/gooddata_legacy2cloud/logging/config.py` at line 43, The formatter string in `configure_logger` is tightly coupled to `ColoredLevelFormatter`, since `%(context_str)s` only works after `ColoredLevelFormatter.format()` injects that attribute. Add a short inline comment near the `formatter = ColoredLevelFormatter(...)` assignment to note that this template must be used only with `ColoredLevelFormatter` (or any formatter that sets `context_str`) so future reuse with a plain `logging.Formatter` is avoided.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/gooddata_legacy2cloud/logging/config.py`:
- Line 43: The formatter string in `configure_logger` is tightly coupled to
`ColoredLevelFormatter`, since `%(context_str)s` only works after
`ColoredLevelFormatter.format()` injects that attribute. Add a short inline
comment near the `formatter = ColoredLevelFormatter(...)` assignment to note
that this template must be used only with `ColoredLevelFormatter` (or any
formatter that sets `context_str`) so future reuse with a plain
`logging.Formatter` is avoided.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1926a6dc-e815-4be9-bcef-dd935ca96eba
📒 Files selected for processing (1)
src/gooddata_legacy2cloud/logging/config.py
Summary by CodeRabbit