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

Support hex strings to prevent broken log lines #13128

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ls-todd-lunter
Copy link

@ls-todd-lunter ls-todd-lunter commented Jun 13, 2024

Discussion

While trying to record Firestore logs within our app, we started to notice many log lines were being reported as (null) in the Console. This seems to be because when logging the reference to the C++ objects, the %s format was adding non-UTF8 encodable characters into the string. This meant when using MakeNSString in the Firestore logger, those non-UTF8 characters failed the string initialization, and it returns nil.

Since there is already quite a lot of use of absl in the repo, I figured we could quick-win, use that to convert the string to hex and record that instead. I suspect logging the object was meant just to see if the value drifted overtime, rather than anything intrinsic to the object itself, so the hex value should do the same thing.

Testing

I only added a test for the record hex value itself. Otherwise, it will behave the same for other types.

API Changes

None, internal to the SDK.

Copy link

google-cla bot commented Jun 13, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@paulb777
Copy link
Member

Thanks for the PR! Please sign the CLA and we can take a look.

@paulb777
Copy link
Member

Closing due to missing CLA. We can reopen when ready.

@paulb777 paulb777 closed this Jul 12, 2024
@ls-todd-lunter
Copy link
Author

Hi @paulb777 apologies, we finally got the CLA resolved! That check is now green.

@paulb777
Copy link
Member

Thanks @ls-todd-lunter! - Please address the code style issues showing up in the check CI - Most likely from four-space vs two-space indenting.

@ls-todd-lunter ls-todd-lunter force-pushed the fix-hex-logging branch 2 times, most recently from aa41ae9 to 53520d3 Compare July 15, 2024 14:35
@ls-todd-lunter
Copy link
Author

Rebased on main to see if it resolves the test failure. Otherwise, I don't think my logging changes would've affected the FIRCompositeIndexQueryTests.

@paulb777
Copy link
Member

@wu-hui PTAL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants