Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't unnecessarily marshal RPC arguments for logging #1733

Merged
merged 2 commits into from
Jul 8, 2023

Conversation

PlasmaPower
Copy link
Collaborator

The current code always marshalled all RPC calls as JSON for logging, even if it would only be logged to trace and trace logging wasn't enabled. This PR replaces that functionality with a lazy struct that only marshals when stringified by the logger, which only happens if the log is actually printed.

I also changed the code to keep the limit on RPC log line length even if there's an error, because the validation RPC logs can be crazy long.

@PlasmaPower PlasmaPower requested a review from tsahee July 1, 2023 06:03
@cla-bot cla-bot bot added the s Automatically added by the CLA bot if the creator of a PR is registered as having signed the CLA. label Jul 1, 2023
Copy link
Contributor

@tsahee tsahee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@PlasmaPower PlasmaPower merged commit c041e98 into master Jul 8, 2023
@PlasmaPower PlasmaPower deleted the rpc-client-optimizations branch July 8, 2023 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s Automatically added by the CLA bot if the creator of a PR is registered as having signed the CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants