Use shared instance of logs to log

This commit is contained in:
Ebrahim Tahernejad
2024-02-04 19:19:55 +03:30
committed by GitHub
parent e74b472895
commit faf6928889

View File

@@ -86,7 +86,7 @@ class VPNManager: ObservableObject {
do { do {
try await loadVPNPreference() try await loadVPNPreference()
} catch { } catch {
LogsEventHandler().writeLog(error.localizedDescription) LogsEventHandler.shared.writeLog(error.localizedDescription)
} }
} }
@@ -107,7 +107,7 @@ class VPNManager: ObservableObject {
try await newManager.loadFromPreferences() try await newManager.loadFromPreferences()
self.manager = newManager self.manager = newManager
} catch { } catch {
LogsEventHandler().writeLog(error.localizedDescription) LogsEventHandler.shared.writeLog(error.localizedDescription)
} }
} }
@@ -117,7 +117,7 @@ class VPNManager: ObservableObject {
try await manager.saveToPreferences() try await manager.saveToPreferences()
try await manager.loadFromPreferences() try await manager.loadFromPreferences()
} catch { } catch {
LogsEventHandler().writeLog(error.localizedDescription) LogsEventHandler.shared.writeLog(error.localizedDescription)
} }
} }
@@ -157,7 +157,7 @@ class VPNManager: ObservableObject {
} }
try await self?.loadVPNPreference() try await self?.loadVPNPreference()
} catch { } catch {
LogsEventHandler().writeLog(error.localizedDescription) LogsEventHandler.shared.writeLog(error.localizedDescription)
} }
} }
}.store(in: &cancelBag) }.store(in: &cancelBag)
@@ -188,7 +188,7 @@ class VPNManager: ObservableObject {
} }
} }
} catch { } catch {
LogsEventHandler().writeLog(error.localizedDescription) LogsEventHandler.shared.writeLog(error.localizedDescription)
} }
} }
@@ -202,7 +202,7 @@ class VPNManager: ObservableObject {
"DisableMemoryLimit": (disableMemoryLimit ? "YES" : "NO") as NSString, "DisableMemoryLimit": (disableMemoryLimit ? "YES" : "NO") as NSString,
]) ])
} catch { } catch {
LogsEventHandler().writeLog(error.localizedDescription) LogsEventHandler.shared.writeLog(error.localizedDescription)
} }
connectTime = .now connectTime = .now
} }