@@ -52,24 +52,37 @@ func entryPoint(passing args: __CommandLineArguments_v0?, eventHandler: Event.Ha
52
52
configuration. verbosity = args. verbosity
53
53
54
54
if configuration. verbosity >= 0 {
55
- var advancedOptions = Event . AdvancedConsoleOutputRecorder. Options ( )
56
- advancedOptions. base = . for( FileHandle . stderr)
57
-
58
- advancedOptions. base. useANSIEscapeCodes = true
59
- advancedOptions. base. ansiColorBitDepth = 24
60
- #if os(macOS)
61
- advancedOptions. base. useSFSymbols = true
62
- #endif
63
-
64
- advancedOptions. useHierarchicalOutput = true
65
-
66
- let eventRecorder = Event . AdvancedConsoleOutputRecorder ( options: advancedOptions) { string in
67
- try ? FileHandle . stderr. write ( string)
68
- }
69
-
70
- // Replace the event handler completely with our advanced recorder
71
- configuration. eventHandler = { event, context in
72
- eventRecorder. handle ( event, in: context)
55
+ // Check for experimental console output flag
56
+ if Environment . flag ( named: " SWT_ENABLE_EXPERIMENTAL_CONSOLE_OUTPUT " ) {
57
+ var advancedOptions = Event . AdvancedConsoleOutputRecorder. Options ( )
58
+ advancedOptions. base = . for( FileHandle . stderr)
59
+
60
+ advancedOptions. base. useANSIEscapeCodes = true
61
+ advancedOptions. base. ansiColorBitDepth = 24
62
+ #if os(macOS)
63
+ advancedOptions. base. useSFSymbols = true
64
+ #endif
65
+
66
+ advancedOptions. useHierarchicalOutput = true
67
+
68
+ let eventRecorder = Event . AdvancedConsoleOutputRecorder ( options: advancedOptions) { string in
69
+ try ? FileHandle . stderr. write ( string)
70
+ }
71
+
72
+ // Replace the event handler completely with our advanced recorder
73
+ configuration. eventHandler = { event, context in
74
+ eventRecorder. handle ( event, in: context)
75
+ }
76
+ } else {
77
+ // Use the standard console output recorder
78
+ let eventRecorder = Event . ConsoleOutputRecorder ( options: . for( . stderr) ) { string in
79
+ try ? FileHandle . stderr. write ( string)
80
+ }
81
+
82
+ configuration. eventHandler = { [ oldEventHandler = configuration. eventHandler] event, context in
83
+ oldEventHandler ( event, context)
84
+ eventRecorder. record ( event, in: context)
85
+ }
73
86
}
74
87
}
75
88
0 commit comments