Replace OSLog with Logger.

This commit is contained in:
Brent Simmons committed 2025-10-02 08:54:48 -07:00
1 parent 2aa2756c05
commit 5afb5a7d10
3 files changed
+14 -19

No files matched your search

+6 -7
View File
@@ -7,25 +7,24 @@
//
import UIKit
import os
import RSCore
import os.log
struct ErrorHandler {
private static var log = OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "Application")
private static let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "ErrorHandler")
public static func present(_ viewController: UIViewController) -> (Error) -> () {
return { [weak viewController] error in
if UIApplication.shared.applicationState == .active {
viewController?.presentError(error)
} else {
ErrorHandler.log(error)
log(error)
}
}
}
public static func log(_ error: Error) {
os_log(.error, log: self.log, "%@", error.localizedDescription)
}
public static func log(_ error: Error) {
logger.error("\(error.localizedDescription)")
}
}