From 8626d9dab373fbc43aebe74ac0a59e3c1cb2149d Mon Sep 17 00:00:00 2001 From: Joshua Wolfson Date: Mon, 9 Jun 2025 19:08:25 +1000 Subject: [PATCH] unified logging --- ShipShape/Activities/ASCLogView.swift | 3 ++- ShipShape/Client/ASCClient.swift | 2 +- ShipShape/Utilities/Logger.swift | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ShipShape/Activities/ASCLogView.swift b/ShipShape/Activities/ASCLogView.swift index cd40b6d..2295f7a 100644 --- a/ShipShape/Activities/ASCLogView.swift +++ b/ShipShape/Activities/ASCLogView.swift @@ -9,13 +9,14 @@ import SwiftUI struct ASCLogView: View { @Environment(ASCClient.self) var client + @Logger var logger var body: some View { List { Section("Click to print to Xcode log") { ForEach(client.logEntries) { entry in Button(entry.url) { - print(entry.response) + logger.debug("\(entry.response)") } .buttonStyle(.plain) } diff --git a/ShipShape/Client/ASCClient.swift b/ShipShape/Client/ASCClient.swift index fac0b8f..31ec287 100644 --- a/ShipShape/Client/ASCClient.swift +++ b/ShipShape/Client/ASCClient.swift @@ -124,7 +124,7 @@ class ASCClient { request.setValue("application/json", forHTTPHeaderField: "Content-Type") let data = try JSONEncoder().encode(content) - print(String(decoding: data, as: UTF8.self)) + logger.info("\(String(decoding: data, as: UTF8.self))") let (_, response) = try await session.data(for: request, delegate: nil) diff --git a/ShipShape/Utilities/Logger.swift b/ShipShape/Utilities/Logger.swift index eeae4b1..30c0e25 100644 --- a/ShipShape/Utilities/Logger.swift +++ b/ShipShape/Utilities/Logger.swift @@ -6,7 +6,7 @@ // import Foundation -import OSLog +import os @propertyWrapper struct Logger {