python: add framed transport packet logging#482
Open
wdfk-prog wants to merge 1 commit into
Open
Conversation
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
Choose Correct
Describe the pull request
Add optional packet logging support for Python framed transports.
This PR introduces an environment-variable driven packet logger for Python eRPC framed transports. It can log TX/RX frames from existing Python clients or servers without application source changes.
Main changes:
erpc.logpacket logging helpers.server.pyandclient.pymodules are available.ERPC_PYTHON_PACKET_LOG_PRETTY=1.erpc_python/README.mdwith configuration examples and environment variable documentation.Packet logging is disabled by default. Existing behavior is unchanged unless
ERPC_PYTHON_PACKET_LOGis configured.To Reproduce
For console logging:
PowerShell example:
For JSON file logging:
ERPC_PYTHON_PACKET_LOG=erpc-uart.jsonl ERPC_PYTHON_PACKET_LOG_APPEND=0 \ python examples/matrix_multiply_python/matrix_multiply.py --client --serial /dev/ttyS1 --baud 115200For IDL-aware decode:
PYTHONPATH=erpc_python:examples/matrix_multiply_python \ ERPC_PYTHON_PACKET_LOG=erpc-uart.jsonl \ ERPC_PYTHON_PACKET_LOG_IDL=service.erpc_matrix_multiply \ python examples/matrix_multiply_python/matrix_multiply.py --client --serial /dev/ttyS1 --baud 115200Expected behavior
When packet logging is disabled, Python eRPC framed transports behave as before.
When packet logging is enabled:
ERPC_PYTHON_PACKET_LOG_PRETTY=1.Screenshots
Not applicable.
Desktop (please complete the following information):
Steps you didn't forgot to do
Additional context
This is intended to simplify debugging Python eRPC links over framed transports such as serial, TCP, SPI and I2C. The logger is configured entirely through environment variables, so existing examples and user applications can capture packet-level diagnostics without source changes.
IDL reply decoding depends on the logger observing the matching invocation first. The request cache key includes transport instance ID, service ID, request ID and sequence number to avoid collisions when multiple transports are active.