From a6f80135ef65f33da67459b56c7f659c64d6d341 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sun, 17 Mar 2019 00:41:10 -0600 Subject: ringlogger: support mpsc for singlefile Signed-off-by: Jason A. Donenfeld --- WireGuard/WireGuard/UI/iOS/AppDelegate.swift | 2 +- .../UI/iOS/ViewController/SettingsTableViewController.swift | 7 +------ WireGuard/WireGuard/UI/macOS/AppDelegate.swift | 2 +- .../UI/macOS/ViewController/TunnelsListTableViewController.swift | 7 +------ 4 files changed, 4 insertions(+), 14 deletions(-) (limited to 'WireGuard/WireGuard/UI') diff --git a/WireGuard/WireGuard/UI/iOS/AppDelegate.swift b/WireGuard/WireGuard/UI/iOS/AppDelegate.swift index 8743c70..d274280 100644 --- a/WireGuard/WireGuard/UI/iOS/AppDelegate.swift +++ b/WireGuard/WireGuard/UI/iOS/AppDelegate.swift @@ -11,7 +11,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var mainVC: MainViewController? func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - Logger.configureGlobal(withFilePath: FileManager.appLogFileURL?.path) + Logger.configureGlobal(tagged: "APP", withFilePath: FileManager.logFileURL?.path) let window = UIWindow(frame: UIScreen.main.bounds) window.backgroundColor = .white diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/SettingsTableViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/SettingsTableViewController.swift index 3addea4..ff83b2c 100644 --- a/WireGuard/WireGuard/UI/iOS/ViewController/SettingsTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/ViewController/SettingsTableViewController.swift @@ -126,12 +126,7 @@ class SettingsTableViewController: UITableViewController { } } - guard let networkExtensionLogFilePath = FileManager.networkExtensionLogFileURL?.path else { - ErrorPresenter.showErrorAlert(title: tr("alertUnableToFindExtensionLogPathTitle"), message: tr("alertUnableToFindExtensionLogPathMessage"), from: self) - return - } - - let isWritten = Logger.global?.writeLog(called: "APP", mergedWith: networkExtensionLogFilePath, called: "NET", to: destinationURL.path) ?? false + let isWritten = Logger.global?.writeLog(to: destinationURL.path) ?? false DispatchQueue.main.async { guard isWritten else { diff --git a/WireGuard/WireGuard/UI/macOS/AppDelegate.swift b/WireGuard/WireGuard/UI/macOS/AppDelegate.swift index cbe6153..9f08e15 100644 --- a/WireGuard/WireGuard/UI/macOS/AppDelegate.swift +++ b/WireGuard/WireGuard/UI/macOS/AppDelegate.swift @@ -14,7 +14,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { var manageTunnelsWindowObject: NSWindow? func applicationDidFinishLaunching(_ aNotification: Notification) { - Logger.configureGlobal(withFilePath: FileManager.appLogFileURL?.path) + Logger.configureGlobal(tagged: "APP", withFilePath: FileManager.logFileURL?.path) TunnelsManager.create { [weak self] result in guard let self = self else { return } diff --git a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift index 7f2dbc8..8987f79 100644 --- a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift +++ b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift @@ -198,17 +198,12 @@ class TunnelsListTableViewController: NSViewController { let timeStampString = dateFormatter.string(from: Date()) savePanel.nameFieldStringValue = "wireguard-log-\(timeStampString).txt" - guard let networkExtensionLogFilePath = FileManager.networkExtensionLogFileURL?.path else { - ErrorPresenter.showErrorAlert(title: tr("alertUnableToFindExtensionLogPathTitle"), message: tr("alertUnableToFindExtensionLogPathMessage"), from: self) - return - } - savePanel.beginSheetModal(for: window) { response in guard response == .OK else { return } guard let destinationURL = savePanel.url else { return } DispatchQueue.global(qos: .userInitiated).async { - let isWritten = Logger.global?.writeLog(called: "APP", mergedWith: networkExtensionLogFilePath, called: "NET", to: destinationURL.path) ?? false + let isWritten = Logger.global?.writeLog(to: destinationURL.path) ?? false guard isWritten else { DispatchQueue.main.async { [weak self] in ErrorPresenter.showErrorAlert(title: tr("alertUnableToWriteLogTitle"), message: tr("alertUnableToWriteLogMessage"), from: self) -- cgit v1.2.3-59-g8ed1b