Restore ANSI colors from iOS simulator logs#186605
Open
mvincentong wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces logic to restore ANSI escape sequences in iOS simulator logs that are escaped by Apple's unified logging system. It adds a regex and a helper method to convert these escaped patterns back to standard ANSI codes, along with a unit test to verify the behavior. Review feedback identifies a style guide violation regarding the use of triple-slash documentation for private members and points out a logic issue where the early return check in the restoration method could skip messages containing only certain escaped characters.
2178c00 to
8b975b8
Compare
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.
Issue
Fixes #20663.
Fix
Normalize the ANSI escape placeholders emitted by Apple unified logging before iOS Simulator log lines are forwarded to Flutter tooling output. The change restores CSI sequences such as color starts and resets after the eventMessage JSON string has been decoded.
Tests
../../bin/dart test test/general.shard/ios/simulators_test.dart../../bin/dart analyze lib/src/ios/simulators.dart test/general.shard/ios/simulators_test.dart./bin/dart format --output=none --set-exit-if-changed packages/flutter_tools/lib/src/ios/simulators.dart packages/flutter_tools/test/general.shard/ios/simulators_test.dartgit diff --checkRisk
Low. The normalization is limited to the iOS Simulator unified-log reader and only runs when the decoded message contains an Apple escaped ANSI CSI pattern or the later ESC placeholder reported in the issue.