debug log sent/received payload#27
Merged
Merged
Conversation
|
There was a problem hiding this comment.
Pull request overview
Adds opt-in debug-level wire payload logging to both SimpleClient and SharedClient via a small shared PayloadLogging mixin. When a logger: is configured, each raw JSON frame sent/received is emitted at DEBUG with >>/<< markers; otherwise it's a no-op.
Changes:
- Introduces
JRPC::PayloadLoggingmixin providinglog_sent/log_receivedhelpers and includes it inSimpleClientandSharedClient::TransportLoop. - Wires
log_sent/log_receivedcalls aroundwrite_frame/read_framein both clients, and refactorslog_errorto use the newlog_taghelper. - Documents the behavior in the README and CHANGELOG, and adds RSpec coverage (plus stubs
debug: nilon existinginstance_double(Logger, ...)test doubles).
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| lib/jrpc/payload_logging.rb | New mixin with log_sent/log_received helpers, no-op without a logger. |
| lib/jrpc.rb | Requires the new payload_logging file. |
| lib/jrpc/simple_client.rb | Includes mixin, logs sent/received frames around transport I/O, defines log_tag. |
| lib/jrpc/shared_client/transport_loop.rb | Includes mixin, logs sent/received frames, switches log_error to use log_tag. |
| README.md | Documents the logger: DEBUG payload-logging behavior. |
| CHANGELOG.md | Adds a "New" entry describing the feature. |
| spec/simple_client_spec.rb | Adds a debug payload logging describe block covering request, notification, and no-logger cases. |
| spec/shared_client_spec.rb | Adds a debug-logging test and stubs debug: nil on existing logger doubles. |
| spec/shared_client/fiber_spec.rb | Stubs debug: nil on the cancellation-test logger double. |
💡 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.
No description provided.