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

[C++] Fix ServerError is not converted to string in log #9277

Merged
merged 1 commit into from
Jan 23, 2021

Conversation

BewareMyPower
Copy link
Contributor

@BewareMyPower BewareMyPower commented Jan 22, 2021

Fixes #9211

Motivation

In some code of C++ client, the protobuf generated ServerError is passed to LOG_XXX directly, so the logs only contain the enum integer value but not the description string. This PR is to fix it for more readable logs.

Modifications

The ClientConnection.cc already provides a getResult function for converting ServerError to Result , but some references of ServerError don't call the function. So this PR overrides operator<< for ServerError and convert it to Result in LOG_XXX macros that use std::stringstream::operator<< to serialize variables to string.

Verifying this change

  • Make sure that the change passes the CI checks.

This change is a trivial rework / code cleanup without any test coverage.

@sijie sijie added this to the 2.8.0 milestone Jan 22, 2021
@BewareMyPower
Copy link
Contributor Author

/pulsarbot run-failure-checks

@zymap
Copy link
Member

zymap commented Jan 23, 2021

/pulsarbot run-failure-checks

@merlimat merlimat merged commit daa79de into apache:master Jan 23, 2021
@BewareMyPower BewareMyPower deleted the bewaremypower/cpp-log-fix branch January 25, 2021 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error Code Meanings
4 participants