diff --git a/Sources/NetworkProtection/Diagnostics/NetworkProtectionServerStatusMonitor.swift b/Sources/NetworkProtection/Diagnostics/NetworkProtectionServerStatusMonitor.swift index 914357ab7..d9898b0ed 100644 --- a/Sources/NetworkProtection/Diagnostics/NetworkProtectionServerStatusMonitor.swift +++ b/Sources/NetworkProtection/Diagnostics/NetworkProtectionServerStatusMonitor.swift @@ -69,7 +69,7 @@ public actor NetworkProtectionServerStatusMonitor { // MARK: - Start/Stop monitoring public func start(serverName: String, callback: @escaping (ServerStatusResult) -> Void) { - Logger.networkProtectionServerStatusMonitor.debug("⚫️ Starting server status monitor for \(serverName, privacy: .public)") + Logger.networkProtectionServerStatusMonitor.log("⚫️ Starting server status monitor for \(serverName, privacy: .public)") task = Task.periodic(delay: Self.monitoringInterval, interval: Self.monitoringInterval) { let result = await self.checkServerStatus(for: serverName) @@ -77,10 +77,10 @@ public actor NetworkProtectionServerStatusMonitor { switch result { case .success(let serverStatus): if serverStatus.shouldMigrate { - Logger.networkProtectionMemory.debug("⚫️ Initiating server migration away from \(serverName, privacy: .public)") + Logger.networkProtectionMemory.log("⚫️ Initiating server migration away from \(serverName, privacy: .public)") callback(.serverMigrationRequested) } else { - Logger.networkProtectionMemory.debug("⚫️ No migration requested for \(serverName, privacy: .public)") + Logger.networkProtectionMemory.log("⚫️ No migration requested for \(serverName, privacy: .public)") } case .failure(let error): Logger.networkProtectionMemory.error("⚫️ Error retrieving server status: \(error.localizedDescription, privacy: .public)") @@ -90,7 +90,7 @@ public actor NetworkProtectionServerStatusMonitor { } public func stop() { - Logger.networkProtectionMemory.error("⚫️ Stopping server status monitor") + Logger.networkProtectionMemory.log("⚫️ Stopping server status monitor") task?.cancel() task = nil diff --git a/Sources/NetworkProtection/Diagnostics/NetworkProtectionTunnelFailureMonitor.swift b/Sources/NetworkProtection/Diagnostics/NetworkProtectionTunnelFailureMonitor.swift index a02a1ae41..17372b28d 100644 --- a/Sources/NetworkProtection/Diagnostics/NetworkProtectionTunnelFailureMonitor.swift +++ b/Sources/NetworkProtection/Diagnostics/NetworkProtectionTunnelFailureMonitor.swift @@ -78,7 +78,7 @@ public actor NetworkProtectionTunnelFailureMonitor { // MARK: - Start/Stop monitoring func start(callback: @escaping (Result) -> Void) { - Logger.networkProtectionTunnelFailureMonitor.debug("⚫️ Starting tunnel failure monitor") + Logger.networkProtectionTunnelFailureMonitor.log("⚫️ Starting tunnel failure monitor") failureReported = false firstCheckSkipped = false @@ -93,7 +93,7 @@ public actor NetworkProtectionTunnelFailureMonitor { } func stop() { - Logger.networkProtectionTunnelFailureMonitor.debug("⚫️ Stopping tunnel failure monitor") + Logger.networkProtectionTunnelFailureMonitor.log("⚫️ Stopping tunnel failure monitor") networkMonitor.cancel() networkMonitor.pathUpdateHandler = nil @@ -108,7 +108,7 @@ public actor NetworkProtectionTunnelFailureMonitor { guard firstCheckSkipped else { // Avoid running the first tunnel failure check after startup to avoid reading the first handshake after sleep, which will almost always // be out of date. In normal operation, the first check will frequently be 0 as WireGuard hasn't had the chance to handshake yet. - Logger.networkProtectionTunnelFailureMonitor.debug("⚫️ Skipping first tunnel failure check") + Logger.networkProtectionTunnelFailureMonitor.log("⚫️ Skipping first tunnel failure check") firstCheckSkipped = true return } @@ -116,23 +116,23 @@ public actor NetworkProtectionTunnelFailureMonitor { let mostRecentHandshake = (try? await handshakeReporter.getMostRecentHandshake()) ?? 0 guard mostRecentHandshake > 0 else { - Logger.networkProtectionTunnelFailureMonitor.debug("⚫️ Got handshake timestamp at or below 0, skipping check") + Logger.networkProtectionTunnelFailureMonitor.log("⚫️ Got handshake timestamp at or below 0, skipping check") return } let difference = Date().timeIntervalSince1970 - mostRecentHandshake - Logger.networkProtectionTunnelFailureMonitor.debug("⚫️ Last handshake: \(difference, privacy: .public) seconds ago") + Logger.networkProtectionTunnelFailureMonitor.log("⚫️ Last handshake: \(difference, privacy: .public) seconds ago") if difference > Result.failureDetected.threshold, isConnected { if failureReported { - Logger.networkProtectionTunnelFailureMonitor.debug("⚫️ Tunnel failure already reported") + Logger.networkProtectionTunnelFailureMonitor.log("⚫️ Tunnel failure already reported") } else { - Logger.networkProtectionTunnelFailureMonitor.debug("⚫️ Tunnel failure reported") + Logger.networkProtectionTunnelFailureMonitor.log("⚫️ Tunnel failure reported") callback(.failureDetected) failureReported = true } } else if difference <= Result.failureRecovered.threshold, failureReported { - Logger.networkProtectionTunnelFailureMonitor.debug("⚫️ Tunnel recovered from failure") + Logger.networkProtectionTunnelFailureMonitor.log("⚫️ Tunnel recovered from failure") callback(.failureRecovered) failureReported = false } diff --git a/Sources/NetworkProtection/KeyManagement/NetworkProtectionKeyStore.swift b/Sources/NetworkProtection/KeyManagement/NetworkProtectionKeyStore.swift index f5c793adb..0df61e950 100644 --- a/Sources/NetworkProtection/KeyManagement/NetworkProtectionKeyStore.swift +++ b/Sources/NetworkProtection/KeyManagement/NetworkProtectionKeyStore.swift @@ -75,17 +75,17 @@ public final class NetworkProtectionKeychainKeyStore: NetworkProtectionKeyStore // MARK: - NetworkProtectionKeyStore public func currentKeyPair() -> KeyPair? { - Logger.networkProtectionKeyManagement.debug("Querying the current key pair (publicKey: \(String(describing: self.currentPublicKey), privacy: .public), expirationDate: \(String(describing: self.currentExpirationDate), privacy: .public))") + Logger.networkProtectionKeyManagement.log("Querying the current key pair (publicKey: \(String(describing: self.currentPublicKey), privacy: .public), expirationDate: \(String(describing: self.currentExpirationDate), privacy: .public))") guard let currentPrivateKey = currentPrivateKey else { - Logger.networkProtectionKeyManagement.debug("There's no current private key.") + Logger.networkProtectionKeyManagement.log("There's no current private key.") return nil } guard let currentExpirationDate = currentExpirationDate, Date().addingTimeInterval(validityInterval) >= currentExpirationDate else { - Logger.networkProtectionKeyManagement.debug("The expirationDate date is missing, or we're past it (now: \(String(describing: Date()), privacy: .public), expirationDate: \(String(describing: self.currentExpirationDate), privacy: .public))") + Logger.networkProtectionKeyManagement.log("The expirationDate date is missing, or we're past it (now: \(String(describing: Date()), privacy: .public), expirationDate: \(String(describing: self.currentExpirationDate), privacy: .public))") return nil } diff --git a/Sources/NetworkProtection/NetworkProtectionDeviceManager.swift b/Sources/NetworkProtection/NetworkProtectionDeviceManager.swift index 389ddd069..762ad1212 100644 --- a/Sources/NetworkProtection/NetworkProtectionDeviceManager.swift +++ b/Sources/NetworkProtection/NetworkProtectionDeviceManager.swift @@ -152,7 +152,7 @@ public actor NetworkProtectionDeviceManager: NetworkProtectionDeviceManagement { } let (selectedServer, newExpiration) = try await register(keyPair: keyPair, selectionMethod: resolvedSelectionMethod) - Logger.networkProtection.debug("Server registration successul") + Logger.networkProtection.log("Server registration successul") keyStore.updateKeyPair(keyPair) diff --git a/Sources/NetworkProtection/Networking/Pinger.swift b/Sources/NetworkProtection/Networking/Pinger.swift index 4e538ee21..3c8a49a6a 100644 --- a/Sources/NetworkProtection/Networking/Pinger.swift +++ b/Sources/NetworkProtection/Networking/Pinger.swift @@ -289,7 +289,7 @@ extension Pinger { let seq = self.nextSeq() sentIndices.insert(Int(seq)) - Logger.networkProtection.debug("PING \(self.ip.debugDescription): \(MemoryLayout.size) data bytes") + Logger.networkProtection.log("PING \(self.ip.debugDescription): \(MemoryLayout.size) data bytes") // form ICMP packet with id, icmp_seq, timestamp and checksum let icmp = ICMP(id: id, index: seq) @@ -352,7 +352,7 @@ extension Pinger { return self.ip }() let r = PingResult(ip: srcIp, bytesCount: bytesCount, seq: Int(response.index), ttl: Int(ip.ip_ttl), time: end - icmp.timestamp) - Logger.networkProtection.debug("\(r.bytesCount) bytes from \(r.ip.debugDescription): icmp_seq=\(r.seq) ttl=\(r.ttl) time=\(r.time * 1000) ms") + Logger.networkProtection.log("\(r.bytesCount) bytes from \(r.ip.debugDescription): icmp_seq=\(r.seq) ttl=\(r.ttl) time=\(r.time * 1000) ms") return .success(r) diff --git a/Sources/NetworkProtection/PacketTunnelProvider.swift b/Sources/NetworkProtection/PacketTunnelProvider.swift index b9e9de1da..fb133916c 100644 --- a/Sources/NetworkProtection/PacketTunnelProvider.swift +++ b/Sources/NetworkProtection/PacketTunnelProvider.swift @@ -167,7 +167,7 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { if logLevel == .error { Logger.networkProtection.error("🔴 Received error from adapter: \(message, privacy: .public)") } else { - Logger.networkProtection.debug("Received message from adapter: \(message, privacy: .public)") + Logger.networkProtection.log("Received message from adapter: \(message, privacy: .public)") } } }() @@ -266,7 +266,7 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { private let tokenStore: NetworkProtectionTokenStore private func resetRegistrationKey() { - Logger.networkProtectionKeyManagement.debug("Resetting the current registration key") + Logger.networkProtectionKeyManagement.log("Resetting the current registration key") keyStore.resetCurrentKeyPair() } @@ -279,10 +279,10 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { } private func rekeyIfExpired() async { - Logger.networkProtectionKeyManagement.debug("Checking if rekey is necessary...") + Logger.networkProtectionKeyManagement.log("Checking if rekey is necessary...") guard isKeyExpired else { - Logger.networkProtectionKeyManagement.debug("The key is not expired") + Logger.networkProtectionKeyManagement.log("The key is not expired") return } @@ -294,7 +294,7 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { // Experimental option to disable rekeying. guard !settings.disableRekeying else { - Logger.networkProtectionKeyManagement.debug("Rekeying disabled") + Logger.networkProtectionKeyManagement.log("Rekeying disabled") return } @@ -325,10 +325,10 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { private func setKeyValidity(_ interval: TimeInterval?) { if let interval { let firstExpirationDate = Date().addingTimeInterval(interval) - Logger.networkProtectionKeyManagement.debug("Setting key validity interval to \(String(describing: interval), privacy: .public) seconds (next expiration date \(String(describing: firstExpirationDate), privacy: .public))") + Logger.networkProtectionKeyManagement.log("Setting key validity interval to \(String(describing: interval), privacy: .public) seconds (next expiration date \(String(describing: firstExpirationDate), privacy: .public))") settings.registrationKeyValidity = .custom(interval) } else { - Logger.networkProtectionKeyManagement.debug("Resetting key validity interval") + Logger.networkProtectionKeyManagement.log("Resetting key validity interval") settings.registrationKeyValidity = .automatic } @@ -679,7 +679,7 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { prepareToConnect(using: tunnelProviderProtocol) let startupOptions = StartupOptions(options: options ?? [:]) - Logger.networkProtection.debug("Starting tunnel with options: \(startupOptions.description, privacy: .public)") + Logger.networkProtection.log("Starting tunnel with options: \(startupOptions.description, privacy: .public)") // Reset snooze if the VPN is restarting. self.snoozeTimingStore.reset() @@ -707,7 +707,7 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { providerEvents.fire(.tunnelStartAttempt(.failure(error))) } - Logger.networkProtection.debug("🔴 Stopping VPN due to no auth token") + Logger.networkProtection.log("🔴 Stopping VPN due to no auth token") await attemptShutdownDueToRevokedAccess() throw error @@ -765,17 +765,17 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { private func startTunnel(onDemand: Bool) async throws { do { - Logger.networkProtection.debug("Generating tunnel config") - Logger.networkProtection.debug("Excluded ranges are: \(String(describing: self.settings.excludedRanges), privacy: .public)") - Logger.networkProtection.debug("Server selection method: \(self.currentServerSelectionMethod.debugDescription, privacy: .public)") - Logger.networkProtection.debug("DNS server: \(String(describing: self.settings.dnsSettings), privacy: .public)") + Logger.networkProtection.log("Generating tunnel config") + Logger.networkProtection.log("Excluded ranges are: \(String(describing: self.settings.excludedRanges), privacy: .public)") + Logger.networkProtection.log("Server selection method: \(self.currentServerSelectionMethod.debugDescription, privacy: .public)") + Logger.networkProtection.log("DNS server: \(String(describing: self.settings.dnsSettings), privacy: .public)") let tunnelConfiguration = try await generateTunnelConfiguration(serverSelectionMethod: currentServerSelectionMethod, includedRoutes: includedRoutes ?? [], excludedRoutes: settings.excludedRanges, dnsSettings: settings.dnsSettings, regenerateKey: true) try await startTunnel(with: tunnelConfiguration, onDemand: onDemand) - Logger.networkProtection.debug("Done generating tunnel config") + Logger.networkProtection.log("Done generating tunnel config") } catch { controllerErrorStore.lastErrorMessage = error.localizedDescription throw error @@ -808,7 +808,7 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { #if os(iOS) if #available(iOS 17.0, *), startReason == .manual { try? await updateConnectOnDemand(enabled: true) - Logger.networkProtection.debug("Enabled Connect on Demand due to user-initiated startup") + Logger.networkProtection.log("Enabled Connect on Demand due to user-initiated startup") } #endif } catch { @@ -826,7 +826,7 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { open override func stopTunnel(with reason: NEProviderStopReason) async { providerEvents.fire(.tunnelStopAttempt(.begin)) - Logger.networkProtection.debug("Stopping tunnel with reason \(String(describing: reason), privacy: .public)") + Logger.networkProtection.log("Stopping tunnel with reason \(String(describing: reason), privacy: .public)") do { try await stopTunnel() @@ -835,7 +835,7 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { // Disable Connect on Demand when disabling the tunnel from iOS settings on iOS 17.0+. if #available(iOS 17.0, *), case .userInitiated = reason { try? await updateConnectOnDemand(enabled: false) - Logger.networkProtection.debug("Disabled Connect on Demand due to user-initiated shutdown") + Logger.networkProtection.log("Disabled Connect on Demand due to user-initiated shutdown") } } catch { providerEvents.fire(.tunnelStopAttempt(.failure(error))) @@ -1022,8 +1022,8 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { let newSelectedServer = configurationResult.server self.lastSelectedServer = newSelectedServer - Logger.networkProtection.debug("⚪️ Generated tunnel configuration for server at location: \(newSelectedServer.serverInfo.serverLocation, privacy: .public) (preferred server is \(newSelectedServer.serverInfo.name, privacy: .public))") - Logger.networkProtection.debug("Excluded routes: \(String(describing: excludedRoutes), privacy: .public)") + Logger.networkProtection.log("⚪️ Generated tunnel configuration for server at location: \(newSelectedServer.serverInfo.serverLocation, privacy: .public) (preferred server is \(newSelectedServer.serverInfo.name, privacy: .public))") + Logger.networkProtection.log("Excluded routes: \(String(describing: excludedRoutes), privacy: .public)") return configurationResult.tunnelConfiguration } @@ -1050,7 +1050,7 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { /// We're skipping messages that are very frequent and not likely to affect anything in terms of functionality. /// We can opt to aggregate them somehow if we ever need them - for now I'm disabling. if message != .getDataVolume { - Logger.networkProtectionIPC.debug("⚪️ Received app message: \(String(describing: message), privacy: .public)") + Logger.networkProtectionIPC.log("⚪️ Received app message: \(String(describing: message), privacy: .public)") } switch message { @@ -1328,11 +1328,11 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { @available(iOS 17, *) @MainActor public func handleShutDown() async throws { - Logger.networkProtection.debug("🔴 Disabling Connect On Demand and shutting down the tunnel") + Logger.networkProtection.log("🔴 Disabling Connect On Demand and shutting down the tunnel") let managers = try await NETunnelProviderManager.loadAllFromPreferences() guard let manager = managers.first else { - Logger.networkProtection.debug("Could not find a viable manager, bailing out of shutdown") + Logger.networkProtection.log("Could not find a viable manager, bailing out of shutdown") // Doesn't matter a lot what error we throw here, since we'll try cancelling the // tunnel. throw TunnelError.vpnAccessRevoked @@ -1360,7 +1360,7 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { private func simulateTunnelFailure(completionHandler: ((Data?) -> Void)? = nil) { Task { - Logger.networkProtection.debug("Simulating tunnel failure") + Logger.networkProtection.log("Simulating tunnel failure") adapter.stop { [weak self] error in if let error { @@ -1423,7 +1423,7 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { connectionStatus = .connected(connectedDate: Date()) } - Logger.networkProtection.debug("⚪️ Tunnel interface is \(self.adapter.interfaceName ?? "unknown", privacy: .public)") + Logger.networkProtection.log("⚪️ Tunnel interface is \(self.adapter.interfaceName ?? "unknown", privacy: .public)") // These cases only make sense in the context of a connection that had trouble // and is being fixed, so we want to test the connection immediately. @@ -1667,7 +1667,7 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { private func startConnectionTester(testImmediately: Bool) async throws { guard isConnectionTesterEnabled else { - Logger.networkProtectionConnectionTester.debug("The connection tester is disabled") + Logger.networkProtectionConnectionTester.log("The connection tester is disabled") return } @@ -1680,7 +1680,7 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { } catch { switch error { case NetworkProtectionConnectionTester.TesterError.couldNotFindInterface: - Logger.networkProtectionConnectionTester.debug("Printing current proposed utun: \(String(reflecting: self.adapter.interfaceName), privacy: .public)") + Logger.networkProtectionConnectionTester.log("Printing current proposed utun: \(String(reflecting: self.adapter.interfaceName), privacy: .public)") default: break } @@ -1693,13 +1693,13 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { @MainActor public override func sleep() async { - Logger.networkProtectionSleep.debug("Sleep") + Logger.networkProtectionSleep.log("Sleep") await stopMonitors() } @MainActor public override func wake() { - Logger.networkProtectionSleep.debug("Wake up") + Logger.networkProtectionSleep.log("Wake up") // macOS can launch the extension due to calls to `sendProviderMessage`, so there's // a chance this is being called when the VPN isn't really meant to be connected or @@ -1714,7 +1714,7 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { do { try await handleAdapterStarted(startReason: .wake) - Logger.networkProtectionConnectionTester.debug("🟢 Wake success") + Logger.networkProtectionConnectionTester.log("🟢 Wake success") providerEvents.fire(.tunnelWakeAttempt(.success)) } catch { Logger.networkProtection.error("🔴 Wake error: \(error.localizedDescription, privacy: .public)") @@ -1751,12 +1751,12 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { @MainActor private func startSnooze(duration: TimeInterval) async { if snoozeRequestProcessing { - Logger.networkProtection.debug("Rejecting start snooze request due to existing request processing") + Logger.networkProtection.log("Rejecting start snooze request due to existing request processing") return } snoozeRequestProcessing = true - Logger.networkProtection.debug("Starting snooze mode with duration: \(duration, privacy: .public)") + Logger.networkProtection.log("Starting snooze mode with duration: \(duration, privacy: .public)") await stopMonitors() @@ -1776,7 +1776,7 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { if self.snoozeTimingStore.hasExpired { Task.detached { - Logger.networkProtection.debug("Snooze mode timer expired, canceling snooze now...") + Logger.networkProtection.log("Snooze mode timer expired, canceling snooze now...") await self.cancelSnooze() } } @@ -1791,7 +1791,7 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { private func cancelSnooze() async { if snoozeRequestProcessing { - Logger.networkProtection.debug("Rejecting cancel snooze request due to existing request processing") + Logger.networkProtection.log("Rejecting cancel snooze request due to existing request processing") return } @@ -1808,7 +1808,7 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { return } - Logger.networkProtection.debug("Canceling snooze mode") + Logger.networkProtection.log("Canceling snooze mode") snoozeJustEnded = true try? await startTunnel(onDemand: false) diff --git a/Sources/NetworkProtection/Recovery/FailureRecoveryHandler.swift b/Sources/NetworkProtection/Recovery/FailureRecoveryHandler.swift index df2cd78ac..15a9b1b06 100644 --- a/Sources/NetworkProtection/Recovery/FailureRecoveryHandler.swift +++ b/Sources/NetworkProtection/Recovery/FailureRecoveryHandler.swift @@ -146,11 +146,11 @@ actor FailureRecoveryHandler: FailureRecoveryHandling { isKillSwitchEnabled: isKillSwitchEnabled, regenerateKey: false ) - Logger.networkProtectionTunnelFailureMonitor.debug("🟢 Failure recovery fetched new config.") + Logger.networkProtectionTunnelFailureMonitor.log("🟢 Failure recovery fetched new config.") let newServer = configurationResult.server - Logger.networkProtection.debug(""" + Logger.networkProtection.log(""" 🟢 Failure recovery - originalServerName: \(lastConnectedServer.serverName, privacy: .public) newServerName: \(newServer.serverName, privacy: .public) originalAllowedIPs: \(String(describing: lastConnectedServer.allowedIPs), privacy: .public) @@ -158,7 +158,7 @@ actor FailureRecoveryHandler: FailureRecoveryHandling { """) guard lastConnectedServer.shouldReplace(with: newServer) else { - Logger.networkProtectionTunnelFailureMonitor.debug("🟢 Server failure recovery not necessary.") + Logger.networkProtectionTunnelFailureMonitor.log("🟢 Server failure recovery not necessary.") return .noRecoveryNecessary } @@ -181,10 +181,10 @@ actor FailureRecoveryHandler: FailureRecoveryHandling { } do { try await action() - Logger.networkProtectionTunnelFailureMonitor.debug("🟢 Failure recovery success!") + Logger.networkProtectionTunnelFailureMonitor.log("🟢 Failure recovery success!") return } catch { - Logger.networkProtectionTunnelFailureMonitor.error("🟢 Failure recovery failed. Retrying...") + Logger.networkProtectionTunnelFailureMonitor.log("🟢 Failure recovery failed. Retrying...") } do { try await Task.sleep(interval: currentDelay) diff --git a/Sources/NetworkProtection/Storage/NetworkProtectionTunnelHealthStore.swift b/Sources/NetworkProtection/Storage/NetworkProtectionTunnelHealthStore.swift index d682683c0..154406db1 100644 --- a/Sources/NetworkProtection/Storage/NetworkProtectionTunnelHealthStore.swift +++ b/Sources/NetworkProtection/Storage/NetworkProtectionTunnelHealthStore.swift @@ -64,7 +64,7 @@ public final class NetworkProtectionTunnelHealthStore { return } userDefaults.set(newValue, forKey: Self.isHavingConnectivityIssuesKey) - Logger.networkProtectionConnectionTester.debug("Issues set to \(String(reflecting: newValue), privacy: .public)") + Logger.networkProtectionConnectionTester.log("Issues set to \(String(reflecting: newValue), privacy: .public)") #if os(macOS) postIssueChangeNotification(newValue: newValue) #endif diff --git a/Sources/NetworkProtection/VPNLogger.swift b/Sources/NetworkProtection/VPNLogger.swift index eedcc6474..4388ed097 100644 --- a/Sources/NetworkProtection/VPNLogger.swift +++ b/Sources/NetworkProtection/VPNLogger.swift @@ -41,11 +41,11 @@ public final class VPNLogger { public func log(_ step: AttemptStep, named name: String) { switch step { case .begin: - Logger.networkProtection.debug("🔵 \(name, privacy: .public) attempt begins") + Logger.networkProtection.log("🔵 \(name, privacy: .public) attempt begins") case .failure(let error): Logger.networkProtection.error("🔴 \(name, privacy: .public) attempt failed with error: \(error.localizedDescription, privacy: .public)") case .success: - Logger.networkProtection.debug("🟢 \(name, privacy: .public) attempt succeeded") + Logger.networkProtection.log("🟢 \(name, privacy: .public) attempt succeeded") } } @@ -53,11 +53,11 @@ public final class VPNLogger { public func log(_ step: ConnectionAttempt) { switch step { case .connecting: - Logger.networkProtection.debug("🔵 Connection attempt detected") + Logger.networkProtection.log("🔵 Connection attempt detected") case .failure: Logger.networkProtection.error("🔴 Connection attempt failed") case .success: - Logger.networkProtection.debug("🟢 Connection attempt successful") + Logger.networkProtection.log("🟢 Connection attempt successful") } } @@ -67,7 +67,7 @@ public final class VPNLogger { case .failed(let duration): Logger.networkProtectionConnectionTester.error("🔴 Connection tester (\(duration.rawValue, privacy: .public) - \(server, privacy: .public)) failure") case .recovered(let duration, let failureCount): - Logger.networkProtectionConnectionTester.debug("🟢 Connection tester (\(duration.rawValue, privacy: .public) - \(server, privacy: .public)) recovery (after \(String(failureCount), privacy: .public) failures)") + Logger.networkProtectionConnectionTester.log("🟢 Connection tester (\(duration.rawValue, privacy: .public) - \(server, privacy: .public)) recovery (after \(String(failureCount), privacy: .public) failures)") } } @@ -75,13 +75,13 @@ public final class VPNLogger { public func log(_ step: FailureRecoveryStep) { switch step { case .started: - Logger.networkProtectionTunnelFailureMonitor.debug("🔵 Failure Recovery attempt started") + Logger.networkProtectionTunnelFailureMonitor.log("🔵 Failure Recovery attempt started") case .failed(let error): Logger.networkProtectionTunnelFailureMonitor.error("🔴 Failure Recovery attempt failed with error: \(error.localizedDescription, privacy: .public)") case .completed(let health): switch health { case .healthy: - Logger.networkProtectionTunnelFailureMonitor.debug("🟢 Failure Recovery attempt completed") + Logger.networkProtectionTunnelFailureMonitor.log("🟢 Failure Recovery attempt completed") case .unhealthy: Logger.networkProtectionTunnelFailureMonitor.error("🔴 Failure Recovery attempt ended as unhealthy") } @@ -94,9 +94,9 @@ public final class VPNLogger { case .failureDetected: Logger.networkProtectionTunnelFailureMonitor.error("🔴 Tunnel failure detected") case .failureRecovered: - Logger.networkProtectionTunnelFailureMonitor.debug("🟢 Tunnel failure recovered") + Logger.networkProtectionTunnelFailureMonitor.log("🟢 Tunnel failure recovered") case .networkPathChanged: - Logger.networkProtectionTunnelFailureMonitor.debug("🔵 Tunnel recovery detected path change") + Logger.networkProtectionTunnelFailureMonitor.log("🔵 Tunnel recovery detected path change") } } @@ -106,7 +106,7 @@ public final class VPNLogger { case .error: Logger.networkProtectionLatencyMonitor.error("🔴 There was an error logging the latency") case .quality(let quality): - Logger.networkProtectionLatencyMonitor.debug("Connection quality is: \(quality.rawValue, privacy: .public)") + Logger.networkProtectionLatencyMonitor.log("Connection quality is: \(quality.rawValue, privacy: .public)") } } }