Skip to content

Commit c070860

Browse files
committed
[DNM] Add some verbose logging
1 parent 376414f commit c070860

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
@@ -319,7 +319,12 @@ final class LLBuildProgressTracker: LLBuildBuildSystemDelegate, SwiftCompilerOut
319319
self.observabilityScope.emit(.multipleProducers(output: output, commands: commands))
320320
}
321321

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

324329
func commandProcessHadError(_ command: SPMLLBuild.Command, process: ProcessHandle, message: String) {
325330
self.observabilityScope.emit(.commandError(command: command, message: message))
@@ -343,11 +348,11 @@ final class LLBuildProgressTracker: LLBuildBuildSystemDelegate, SwiftCompilerOut
343348
result: CommandExtendedResult
344349
) {
345350
// FIXME: This should really happen at the command-level and is just a stopgap measure.
346-
let shouldFilterOutput = !self.logLevel.isVerbose && command.verboseDescription.hasPrefix("codesign ") && result
347-
.result != .failed
351+
let shouldFilterOutput = !self.logLevel.isVerbose
348352
self.queue.async {
349353
if let buffer = self.nonSwiftMessageBuffers[command.name], !shouldFilterOutput {
350354
self.progressAnimation.clear()
355+
self.outputStream.send("EXTRA VERBOSE COMMAND FINISHED \(process.hashValue) \(result.exitStatus) for \(command.verboseDescription) with ")
351356
self.outputStream.send(buffer)
352357
self.outputStream.flush()
353358
self.nonSwiftMessageBuffers[command.name] = nil
@@ -628,8 +633,15 @@ extension SwiftCompilerMessage {
628633
fileprivate var verboseProgressText: String? {
629634
switch kind {
630635
case .began(let info):
631-
([info.commandExecutable] + info.commandArguments).joined(separator: " ")
632-
case .skipped, .finished, .abnormal, .signalled, .unparsableOutput:
636+
"EXTRA VERBOSE STARTED \(info.pid): \(([info.commandExecutable] + info.commandArguments).joined(separator: " "))"
637+
case .finished(let info):
638+
"EXTRA VERBOSE FINISHED \(info.pid) with \(info.output ?? "no output")"
639+
case .abnormal(let info),
640+
.signalled(let info):
641+
"EXTRA VERBOSE FAILED \(info.pid) with \(info.output ?? "no output")"
642+
case .unparsableOutput(let output):
643+
"EXTRA VERBOSE UNPARSABLE with \(output)"
644+
case .skipped:
633645
nil
634646
}
635647
}

0 commit comments

Comments
 (0)