-
Notifications
You must be signed in to change notification settings - Fork 117
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
VPN-6041: Add Swift logs from app #9192
Merged
Merged
Conversation
This file contains 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
brizental
reviewed
Mar 13, 2024
brizental
reviewed
Mar 15, 2024
@lesleyjanenorton per our discussion, I made a few small edits. I also looked at all the Swift logs - I couldn't find any that include superfluous names/data, and none that include IP addresses or anything like that. |
brizental
approved these changes
Mar 19, 2024
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.
Description
We've had a problem for a while where only the Swift logs from the network extension are included in the log file output by the app.
Ideally, the swift logs would be inline with the rest of the app logs (from C++ land). I looked into adding a objc bridging header and writing directly to the main logger. Unfortunately, the main logger class uses a lot of Qt imports, and the build fails due to these deeper dependencies. After I did that research, I went with this approach - a somewhat hacky fix. (Given that untangling this would be non-trivial and the current status of the app, I went with a simpler solution.)
I've added a third section of logs to the log output - Swift logs from the main app will exist, but be in their own section. This is done by hackily appending the Swift log section to the backend logs, so it looks no different to the main app. Where possible, I maintained the same code patterns that existed for the backend (network extension) logs.
I had to update our calls from C++ to iOS logging - you'll notice updates to functions with names like
errorToConsoleWithMessage
. Without this, the C++ app logs were logged in two places - the main app logs (as expected) and these new Swift logs. This is because we were sending all C++ logs to Swift-land - but seemingly only to log them to the console. The easiest way in the Swift logging class to separate out "C++ logs to print to console only" and "Swift logs to print to console and to save to disk" was to give those C++ logs their own functions, which is done as part of this PR.Sample logs from a fresh run of the app
Reference
VPN-6041
Checklist