Replace .log w/ explicit .debug/.error functions

This would make the intention more explicit so we can overload different logging types as well like keychain, security events, etc…

Search/Replace Strategies:

1.
Search regex: `SecureLogger\.log\(\s*(.*?),\s*category:\s*(.*?),\s*level:\s*\.(\w+)\s*\)`
Replace regex: `SecureLogger.$3($1, category: $2)`

Sample input:
```
SecureLogger.log(
    "🔄 Found favorite for '\(peerInfo.nickname)' by nickname, updating noise key",
    category: .session,
    level: .debug
)
```

Sample output:
`SecureLogger.debug("🔄 Found favorite for '\(peerInfo.nickname)' by nickname, updating noise key", category: .session)`

---

2.
Search regex: `SecureLogger\.log\((.*?)\)`
Replace regex: `SecureLogger.debug($1)` (as it’s the default level)

Sample input:
`SecureLogger.log("some text")`

Sample output:
`SecureLogger.debug("some text")`

---

3
Manual changes:
ChatViewModel line 5393 (commented code)
NostrRelayManager line 196 (commented code)
NostrRelayManager lines 346-350 (if/else logic)
NostrRelayManager line 371 (commented code)
This commit is contained in:
islam
2025-09-11 19:03:08 +01:00
parent 5ca9222fc2
commit 5d6aecfc83
20 changed files with 362 additions and 487 deletions
+2 -4
View File
@@ -78,8 +78,7 @@ struct NostrProtocol {
)
// Successfully unwrapped gift wrap
} catch {
SecureLogger.log("❌ Failed to unwrap gift wrap: \(error)",
category: .session, level: .error)
SecureLogger.error("❌ Failed to unwrap gift wrap: \(error)", category: .session)
throw error
}
@@ -92,8 +91,7 @@ struct NostrProtocol {
)
// Successfully opened seal
} catch {
SecureLogger.log("❌ Failed to open seal: \(error)",
category: .session, level: .error)
SecureLogger.error("❌ Failed to open seal: \(error)", category: .session)
throw error
}