Skip to content

Commit 3d1dc6c

Browse files
committed
[DNM] Add some verbose logging
1 parent b6a3d95 commit 3d1dc6c

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

Sources/Build/LLBuildProgressTracker.swift

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,12 @@ final class LLBuildProgressTracker: LLBuildBuildSystemDelegate, SwiftCompilerOut
322322
self.observabilityScope.emit(.multipleProducers(output: output, commands: commands))
323323
}
324324

325-
func commandProcessStarted(_ command: SPMLLBuild.Command, process: ProcessHandle) {}
325+
func commandProcessStarted(_ command: SPMLLBuild.Command, process: ProcessHandle) {
326+
self.queue.async {
327+
self.outputStream.send("EXTRA VERBOSE COMMAND STARTED \(process.hashValue) for \(command.verboseDescription)")
328+
self.outputStream.flush()
329+
}
330+
}
326331

327332
func commandProcessHadError(_ command: SPMLLBuild.Command, process: ProcessHandle, message: String) {
328333
self.observabilityScope.emit(.commandError(command: command, message: message))
@@ -346,14 +351,14 @@ final class LLBuildProgressTracker: LLBuildBuildSystemDelegate, SwiftCompilerOut
346351
result: CommandExtendedResult
347352
) {
348353
// FIXME: This should really happen at the command-level and is just a stopgap measure.
349-
let shouldFilterOutput = !self.logLevel.isVerbose && command.verboseDescription.hasPrefix("codesign ") && result
350-
.result != .failed
354+
let shouldFilterOutput = !self.logLevel.isVerbose
351355

352356
let commandName = command.name
353357

354358
self.queue.async {
355359
if let buffer = self.nonSwiftMessageBuffers[commandName], !shouldFilterOutput {
356360
self.progressAnimation.clear()
361+
self.outputStream.send("EXTRA VERBOSE COMMAND FINISHED \(process.hashValue) \(result.exitStatus) for \(command.verboseDescription) with ")
357362
self.outputStream.send(buffer)
358363
self.outputStream.flush()
359364
self.nonSwiftMessageBuffers[commandName] = nil
@@ -634,8 +639,15 @@ extension SwiftCompilerMessage {
634639
fileprivate var verboseProgressText: String? {
635640
switch kind {
636641
case .began(let info):
637-
([info.commandExecutable] + info.commandArguments).joined(separator: " ")
638-
case .skipped, .finished, .abnormal, .signalled, .unparsableOutput:
642+
"EXTRA VERBOSE STARTED \(info.pid): \(([info.commandExecutable] + info.commandArguments).joined(separator: " "))"
643+
case .finished(let info):
644+
"EXTRA VERBOSE FINISHED \(info.pid) with \(info.output ?? "no output")"
645+
case .abnormal(let info),
646+
.signalled(let info):
647+
"EXTRA VERBOSE FAILED \(info.pid) with \(info.output ?? "no output")"
648+
case .unparsableOutput(let output):
649+
"EXTRA VERBOSE UNPARSABLE with \(output)"
650+
case .skipped:
639651
nil
640652
}
641653
}

0 commit comments

Comments
 (0)