aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2019-01-28 17:46:12 +0530
committerRoopesh Chander <roop@roopc.net>2019-01-28 17:50:48 +0530
commitacecc70397037006fc236f942b62d424a1f22018 (patch)
treeed85f17fa4f8cb596a520bbacafb93cf434c7e50
parentRuntime info: Make bytecount and timestamp info prettier (diff)
downloadwireguard-apple-acecc70397037006fc236f942b62d424a1f22018.tar.xz
wireguard-apple-acecc70397037006fc236f942b62d424a1f22018.zip
Logger: Convert do-catch to try?
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to '')
-rw-r--r--WireGuard/Shared/Logging/Logger.swift5
1 files changed, 2 insertions, 3 deletions
diff --git a/WireGuard/Shared/Logging/Logger.swift b/WireGuard/Shared/Logging/Logger.swift
index 6d388207..23cc7194 100644
--- a/WireGuard/Shared/Logging/Logger.swift
+++ b/WireGuard/Shared/Logging/Logger.swift
@@ -41,12 +41,11 @@ public class Logger {
os_log("Unable to determine log destination path. Log will not be saved to file.", log: OSLog.default, type: .error)
return
}
- do {
- try Logger.global = Logger(withFilePath: filePath)
- } catch {
+ guard let logger = try? Logger(withFilePath: filePath) else {
os_log("Unable to open log file for writing. Log will not be saved to file.", log: OSLog.default, type: .error)
return
}
+ Logger.global = logger
var appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "Unknown version"
if let appBuild = Bundle.main.infoDictionary?["CFBundleVersion"] as? String {
appVersion += " (\(appBuild))"