mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-12-01 09:50:16 +00:00
Replace OSLog with Logger.
This commit is contained in:
1 parent
2aa2756c05
commit
5afb5a7d10
3 files changed
+14
-19
No files matched your search
@@ -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)")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user