Write log/error output from commands to stderr. (#1632)

- Closes #1631.
- The standard output should only contain result data,
  so that scripts consuming stdout don't need to scrape.
This commit is contained in:
J Logan
2026-06-03 16:17:59 -07:00
committed by GitHub
parent 94d6d0ac36
commit 89fa98c55a
16 changed files with 26 additions and 25 deletions
@@ -82,7 +82,7 @@ extension Application {
let freed = formatter.string(fromByteCount: Int64(size))
if didDeleteAnyImage {
print("Reclaimed \(freed) in disk space")
log.info("Reclaimed \(freed) in disk space")
}
if failures.count > 0 {
throw ContainerizationError(.internalError, message: "failed to delete one or more images: \(failures)")
@@ -108,7 +108,6 @@ extension Application {
}
await taskManager.finish()
progress.finish()
print("Loaded images:")
for image in result.images {
print(image.reference)
}
@@ -82,7 +82,7 @@ extension Application {
let formatter = ByteCountFormatter()
formatter.countStyle = .file
let freed = formatter.string(fromByteCount: Int64(size))
print("Reclaimed \(freed) in disk space")
log.info("Reclaimed \(freed) in disk space")
}
private func hasTag(_ reference: String) -> Bool {
@@ -84,7 +84,7 @@ extension Application {
do {
images.append(try await ClientImage.get(reference: reference, containerSystemConfig: containerSystemConfig).description)
} catch {
print("failed to get image for reference \(reference): \(error)")
log.error("failed to get image for reference \(reference): \(error)")
}
}