- JarvisLogChannel: four cases (agent, tools, ui, system)
- JarvisLogHandlerFactory.bootstrap wires MultiplexLogHandler that
fans out to FileLogHandler + OSLogHandler (D-17)
- FileLogHandler applies Redact.apply once (S-4 single call site)
- OSLogHandler does NOT redact (os.Logger handles %{private}@ at
system layer; callers redact untrusted input before logging)
- Redact covers exactly 5 patterns: sk-ant-, Authorization:Bearer,
sk- (OpenAI), AKIA, ghp_ (D-20, OBS-06); Anthropic branch ordered
before OpenAI so sk-ant- consumes the full prefix
- FileRotatingWriter: lazy midnight rotation via TestDateProvider-
injectable DateProvider; serial DispatchQueue; retain-7 GC on
rotate (D-18)
- LogPaths.channelDirectory = ~/Library/Logs/Jarvis/
- Swift 6 strict: ISO8601DateFormatter.jarvisShared uses
nonisolated(unsafe) since the formatter is documented thread-safe
after configuration but not Sendable-annotated by Apple
- OSLogHandler uses fully-qualified Logging.Logger to disambiguate
from os.Logger (both imported)
- Tests: 13/13 pass (7 Redact + 2 FileLogHandler rotate/retain +
4 bootstrap/factory/channels)
- Deletes Plan 01 placeholders
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
18 lines
643 B
Swift
18 lines
643 B
Swift
import Foundation
|
|
|
|
public enum LogPaths {
|
|
/// ~/Library/Logs/Jarvis/
|
|
public static var channelDirectory: URL {
|
|
let fm = FileManager.default
|
|
let libraryURL: URL
|
|
do {
|
|
libraryURL = try fm.url(for: .libraryDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
|
|
} catch {
|
|
libraryURL = URL(fileURLWithPath: (NSHomeDirectory() as NSString).appendingPathComponent("Library"))
|
|
}
|
|
let dir = libraryURL.appendingPathComponent("Logs/Jarvis", isDirectory: true)
|
|
try? fm.createDirectory(at: dir, withIntermediateDirectories: true)
|
|
return dir
|
|
}
|
|
}
|