@@ -107,6 +107,7 @@ final class AppState: ObservableObject {
107107 @AppStorage ( " vocamac.soundEffectsEnabled " ) var soundEffectsEnabled : Bool = true
108108 @AppStorage ( " vocamac.showCursorIndicator " ) var showCursorIndicator : Bool = true
109109 @AppStorage ( " vocamac.translationEnabled " ) var translationEnabled : Bool = false
110+ @AppStorage ( " vocamac.logLevel " ) var logLevel : String = " info "
110111
111112 // MARK: - Services
112113
@@ -125,7 +126,7 @@ final class AppState: ObservableObject {
125126 // MARK: - Initialization
126127
127128 init ( ) {
128- NSLog ( " [AppState] Initializing..." )
129+ VocaLogger . info ( . appState , " Initializing... " )
129130 setupServices ( )
130131 // Trigger startup automatically
131132 Task {
@@ -480,46 +481,43 @@ final class AppState: ObservableObject {
480481 // MARK: - Startup
481482
482483 func performStartup( ) async {
483- NSLog ( " [AppState] performStartup beginning..." )
484+ VocaLogger . info ( . appState , " performStartup beginning... " )
484485
485486 // 1. Detect hardware
486487 systemCapabilities = SystemInfo . detect ( )
487- NSLog ( " [AppState] System: %@ | %d GB RAM | %d cores " ,
488- systemCapabilities? . processorName ?? " unknown " ,
489- systemCapabilities? . physicalMemoryGB ?? 0 ,
490- systemCapabilities? . coreCount ?? 0 )
488+ let sysInfo = systemCapabilities
489+ VocaLogger . info ( . appState, " System: \( sysInfo? . processorName ?? " unknown " ) | \( sysInfo? . physicalMemoryGB ?? 0 ) GB RAM | \( sysInfo? . coreCount ?? 0 ) cores " )
491490
492491 // 2. Check/request permissions
493492 checkPermissions ( )
494- NSLog ( " [AppState] Mic permission: %@ | Accessibility: %@ | Input Monitoring: %@ " ,
495- micPermission. rawValue, accessibilityPermission. rawValue, inputMonitoringPermission. rawValue)
493+ VocaLogger . info ( . appState, " Mic permission: \( micPermission. rawValue) | Accessibility: \( accessibilityPermission. rawValue) | Input Monitoring: \( inputMonitoringPermission. rawValue) " )
496494
497495 // Auto-prompt for microphone permission on first launch
498496 if micPermission == . notDetermined {
499- NSLog ( " [AppState] Mic permission not determined — requesting..." )
497+ VocaLogger . info ( . appState , " Mic permission not determined — requesting... " )
500498 requestMicrophonePermission ( )
501499 }
502500
503501 // 3. Load model — let WhisperKit auto-select and download the best model
504- NSLog ( " [AppState] Loading WhisperKit model (auto-select)..." )
502+ VocaLogger . info ( . appState , " Loading WhisperKit model (auto-select)... " )
505503 await loadModel ( )
506504 NSLog ( " [AppState] Model loaded: %@ " , whisperService. loadedModelName ?? " none " )
507505
508506 // 4. Always attempt to start hotkey listener
509507 // The event tap creation itself will fail if permissions aren't granted,
510508 // and we handle that gracefully in HotKeyManager.
511- NSLog ( " [AppState] Attempting to start hotkey listener..." )
509+ VocaLogger . info ( . appState , " Attempting to start hotkey listener... " )
512510 hotKeyManager. startListening (
513511 keyCode: hotKeyCode,
514512 mode: activationMode,
515513 doubleTapThreshold: doubleTapThreshold
516514 )
517515 if hotKeyManager. isListening {
518- NSLog ( " [AppState] Hotkey listener active (keyCode=%d , mode=%@) " , hotKeyCode , activationMode. rawValue)
516+ VocaLogger . info ( . appState , " Hotkey listener active (keyCode= \( hotKeyCode ) , mode= \( activationMode. rawValue) ) " )
519517 } else {
520- NSLog ( " [AppState] WARNING: Hotkey listener failed to start. Check Accessibility & Input Monitoring permissions." )
518+ VocaLogger . warning ( . appState , " Hotkey listener failed to start. Check Accessibility & Input Monitoring permissions. " )
521519 }
522520
523- NSLog ( " [AppState] Startup complete!" )
521+ VocaLogger . info ( . appState , " Startup complete! " )
524522 }
525523}
0 commit comments