fix: [CN-70] require JSON processors in log handlers#67
Merged
vpakhuchyi merged 1 commit intomainfrom Nov 17, 2025
Merged
Conversation
- add Processor.OutputFormat so integrations can inspect the active encoder - guard zerolog, zap, and slog handlers against text-mode processors - document the JSON requirement and cover panic paths with regression tests
There was a problem hiding this comment.
Pull Request Overview
This pull request adds validation to ensure log handlers only accept JSON-mode processors, preventing runtime issues when text-mode processors are used with structured logging frameworks.
- Introduces
OutputFormat()method onProcessorto expose the configured output format - Adds runtime checks in zerolog, zap, and slog handlers that panic if a text-mode processor is provided
- Includes comprehensive test coverage for the new validation logic
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| processor.go | Adds OutputFormat() method to expose processor configuration; refactors string literal to use constant |
| processor_test.go | Adds test coverage for OutputFormat() method including nil processor panic case |
| handlers/zerolog/handler.go | Adds validation to panic if text-mode processor is used; updates function signature to use any instead of interface{} |
| handlers/zerolog/handler_test.go | Adds regression test for text-mode processor panic scenario; fixes indentation in existing test |
| handlers/zerolog/doc.go | Documents JSON requirement for processors |
| handlers/zap/handler.go | Adds validation to panic if text-mode processor is used |
| handlers/zap/handler_test.go | Adds regression test for text-mode processor panic scenario |
| handlers/zap/doc.go | Documents JSON requirement for processors |
| handlers/slog/handler.go | Adds validation to panic if text-mode processor is used |
| handlers/slog/handler_test.go | Adds regression test for text-mode processor panic scenario |
| handlers/slog/doc.go | Documents JSON requirement; updates example email address for consistency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Pull request
Link to the related ticket
https://censor.atlassian.net/browse/CN-70
Description of changes
Checklist
Please ensure that your pull request complies with the following requirements: