Skip to content

Commit

Permalink
Log actions publicly (#44)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
gordonbrander authored Dec 5, 2023
1 parent e648004 commit 371a014
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion Sources/ObservableStore/ObservableStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 371a014

Please sign in to comment.