Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put logging string in closure #106

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions Sources/AppState/Application/Application+public.swift
Original file line number Diff line number Diff line change
Expand Up @@ -673,16 +673,15 @@ public extension Application {
_ column: Int = #column
) -> SecureState {
let secureState = shared.value(keyPath: keyPath)
let debugMessage: String

#if DEBUG
debugMessage = "🔑 Getting SecureState \(String(describing: keyPath)) -> \(secureState.value ?? "nil")"
#else
debugMessage = "🔑 Getting SecureState \(String(describing: keyPath))"
#endif

log(
debug: debugMessage,
debug: {
#if DEBUG
"🔑 Getting SecureState \(String(describing: keyPath)) -> \(secureState.value ?? "nil")"
#else
"🔑 Getting SecureState \(String(describing: keyPath))"
#endif
},
fileID: fileID,
function: function,
line: line,
Expand Down
16 changes: 7 additions & 9 deletions Sources/AppState/PropertyWrappers/State/SecureState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,14 @@ import SwiftUI
).value
}
nonmutating set {
let debugMessage: String

#if DEBUG
debugMessage = "🔑 Setting SecureState \(String(describing: keyPath)) = \(newValue ?? "nil")"
#else
debugMessage = "🔑 Setting SecureState \(String(describing: keyPath))"
#endif

Application.log(
debug: debugMessage,
debug: {
#if DEBUG
"🔑 Setting SecureState \(String(describing: keyPath)) = \(newValue ?? "nil")"
#else
"🔑 Setting SecureState \(String(describing: keyPath))"
#endif
},
fileID: fileID,
function: function,
line: line,
Expand Down
Loading