         
         let keychains : SecKeychain? = nil // use the default keychain
         
+        os_log("Storing new password in Keychain: service name: %{public} account name: %{public}@", keychainServiceName, keychainAccountName)
         let status = SecKeychainAddGenericPassword(keychains, UInt32(strlen(serviceNameData)), serviceNameData, UInt32(strlen(accountNameData)), accountNameData, UInt32(strlen(passwordData)), passwordData!, &unmanagedItem)
         
         if(status != errSecSuccess) {
-            NSLog("Problem storing Blockstack Core wallet password to Keychain \(SecCopyErrorMessageString(status, nil))");
+            os_log("Problem storing Blockstack Core wallet password to Keychain %{public}@", log: log, type: .error, (SecCopyErrorMessageString(status, nil) as! CVarArg))
         }
         
         return password
     }
     
     func generatePassword() -> String {
+        os_log("generatePassword", log: log, type: .debug)
         // this isn't necessarily secure or random, but good enough for our purposes.
         return ProcessInfo.processInfo.globallyUniqueString
     }

    
    func startCoreAPI(walletPassword: String, complete: @escaping () -> Void) {
        if let archivePath = Bundle.main.path(forResource: coreArchive, ofType: "") {
            NSLog("Blockstack Virtualenv archive path: \(archivePath)")
            
            NSLog("Extract Core venv to: \(extractCoreVenvToPath)")
            NSLog("Blockstack Core config file path: \(coreConfigPath())")
            NSLog("Blockstack Virtualenv Path: \(coreVenvPath())")
            NSLog("Blockstack path: \(blockstackPath())")
            
            let extractProcess = Process()
            let coreAPISetupProcess = Process()

        let proxyPath = Bundle.main.path(forResource: "blockstackProxy", ofType: "")
        let portalPath = Bundle.main.path(forResource: "browser", ofType: "")
        
        os_log("Portal proxy path: %{public}@", log: log, type: .info, proxyPath!)
        os_log("Portal path: %{public}@", log: log, type: .info, portalPath!)
        
        do {
            os_log("Trying to remove any existing portal code...", log: log, type: .info)
            try FileManager.default.removeItem(atPath: portalRunPath())
        } catch {
            os_log("Can't remove existing portal code. It probably doesn't exist.", log: log, type: .info)
        }
        
        os_log("Copying the latest portal code into the portal run path %{public}@", log: log, type: .info, portalRunPath())

        do {
            try FileManager.default.copyItem(atPath: portalPath!, toPath: portalRunPath())
        } catch {
            os_log("Can't copy Portal code to the run path: %{public}@", log: log, type: .error, portalRunPath())
        }
        
            
