From 371a014b535fe9941f71041f1bded9e4e7a49fba Mon Sep 17 00:00:00 2001 From: Gordon Brander Date: Mon, 4 Dec 2023 19:40:50 -0500 Subject: [PATCH] Log actions publicly (#44) * Log actions publicly This puts the burden on the developer to mask sensitive data by implementing `CustomStringConvertible`, if logging is enabled. * Bump mac version Privacy controls for logs are only available in macOS v11+ * Log at debug level --- Package.swift | 2 +- Sources/ObservableStore/ObservableStore.swift | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Package.swift b/Package.swift index 51f2526..bce1361 100644 --- a/Package.swift +++ b/Package.swift @@ -5,7 +5,7 @@ import PackageDescription let package = Package( name: "ObservableStore", - platforms: [.macOS(.v10_15), .iOS(.v15)], + platforms: [.macOS(.v11), .iOS(.v15)], products: [ // Products define the executables and libraries a package produces, and make them visible to other packages. .library( diff --git a/Sources/ObservableStore/ObservableStore.swift b/Sources/ObservableStore/ObservableStore.swift index fb60b70..8f561df 100644 --- a/Sources/ObservableStore/ObservableStore.swift +++ b/Sources/ObservableStore/ObservableStore.swift @@ -332,7 +332,8 @@ where Model: ModelProtocol /// run on main thread when SwiftUI is being used. public func send(_ action: Model.Action) { if loggingEnabled { - logger.log("Action: \(String(describing: action))") + let actionString = String(describing: action) + logger.debug("Action: \(actionString, privacy: .public)") } // Dispatch action before state change