aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-12-13 15:38:10 +0530
committerRoopesh Chander <roop@roopc.net>2018-12-13 17:37:14 +0530
commitae7fb7323faf6321d07dd855ea4f7641d2424ec0 (patch)
treee06c8af688ca2de4c0464b7d206a140d9cf92f3d /WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift
parentAvoid using 'VPN' in code where possible (diff)
downloadwireguard-apple-ae7fb7323faf6321d07dd855ea4f7641d2424ec0.tar.xz
wireguard-apple-ae7fb7323faf6321d07dd855ea4f7641d2424ec0.zip
Logging: Use ringlogger for logging from the extension
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift')
-rw-r--r--WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift18
1 files changed, 7 insertions, 11 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift b/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift
index fe276b1..43e277e 100644
--- a/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift
@@ -108,23 +108,19 @@ class SettingsTableViewController: UITableViewController {
if FileManager.default.fileExists(atPath: destinationURL.path) {
let isDeleted = FileManager.deleteFile(at: destinationURL)
if !isDeleted {
- ErrorPresenter.showErrorAlert(title: "No log available", message: "The pre-existing log could not be cleared", from: self)
+ ErrorPresenter.showErrorAlert(title: "Log export failed", message: "The pre-existing log could not be cleared", from: self)
return
}
}
- guard let networkExtensionLogFileURL = FileManager.networkExtensionLogFileURL,
- FileManager.default.fileExists(atPath: networkExtensionLogFileURL.path) else {
- ErrorPresenter.showErrorAlert(title: "No log available", message: "Please activate a tunnel and then export the log", from: self)
- return
+ guard let networkExtensionLogFilePath = FileManager.networkExtensionLogFileURL?.path else {
+ ErrorPresenter.showErrorAlert(title: "Log export failed", message: "Internal error obtaining extension log path", from: self)
+ return
}
- do {
- try FileManager.default.copyItem(at: networkExtensionLogFileURL, to: destinationURL)
- } catch {
- os_log("Failed to copy file: %{public}@ to %{public}@: %{public}@", log: OSLog.default, type: .error,
- networkExtensionLogFileURL.absoluteString, destinationURL.absoluteString, error.localizedDescription)
- ErrorPresenter.showErrorAlert(title: "Log export failed", message: "The log could not be copied", from: self)
+ let isWritten = Logger.writeLog(mergedWith: networkExtensionLogFilePath, to: destinationURL.path)
+ guard isWritten else {
+ ErrorPresenter.showErrorAlert(title: "Log export failed", message: "Internal error merging logs", from: self)
return
}