Skip to content

Commit

Permalink
Made interpolated strings visible in unified logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
erikdoe committed Aug 16, 2024
1 parent f326d27 commit b96fccf
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CCMenu/Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>2252.1</string>
<string>2252.3</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
Expand Down
6 changes: 3 additions & 3 deletions CCMenu/Source/Miscellaneous/Keychain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ class Keychain {
func getPassword(forURL url: URL) throws -> String? {
let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "keychain")
if let password = cache[url.absoluteString] {
logger.log("Using cached password for \(url)")
logger.log("Using cached password for \(url, privacy: .public)")
return password
}
logger.log("Retrieving password for \(url) from keychain")
logger.log("Retrieving password for \(url, privacy: .public) from keychain")
let query = [
kSecClass: kSecClassInternetPassword,
kSecAttrServer: try getOrThrow(error: .missingHostErr) { url.host() },
Expand All @@ -66,7 +66,7 @@ class Keychain {
] as NSDictionary
let password = try getStringForQuery(query)
if let password {
logger.log("Got password (length = \(password.count))")
logger.log("Got password (length = \(password.count, privacy: .public))")
} else {
logger.log("Didn't get a password")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class CCTrayPipelineBuilder: ObservableObject {
try Keychain.standard.setPassword(credential.password, forURL: newUrl.absoluteString)
} catch {
let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "keychain")
logger.error("Error when storing password in keychain: \(error.localizedDescription)")
logger.error("Error when storing password in keychain: \(error.localizedDescription, privacy: .public)")
}
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions CCMenu/Source/Server Monitor/CCTrayAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class CCTrayAPI {
let v = URLRequest.basicAuthValue(user: credential.user, password: credential.password)
request.setValue(v, forHTTPHeaderField: "Authorization")
let redacted = v.replacingOccurrences(of: "[A-Za-z0-9=]", with: "*", options: [.regularExpression])
logger.log("Making request for url \(url) with authorization \(redacted)")
logger.log("Making request for url \(url, privacy: .public) with authorization \(redacted, privacy: .public)")
} else {
logger.log("Making request for url \(url)")
logger.log("Making request for url \(url, privacy: .public)")
}

return request
Expand Down

0 comments on commit b96fccf

Please sign in to comment.