mirror of
https://github.com/samsonjs/NotificationSmuggler.git
synced 2026-03-25 08:25:48 +00:00
Use os.log instead of NSLog
This commit is contained in:
parent
f7c096ae62
commit
94845eb55c
1 changed files with 5 additions and 2 deletions
|
|
@ -1,5 +1,8 @@
|
|||
import Combine
|
||||
import Foundation
|
||||
import os.log
|
||||
|
||||
private let log = Logger(subsystem: "NotificationSmuggler", category: "smuggling")
|
||||
|
||||
public extension Notification {
|
||||
/// Creates a `Notification` instance that smuggles the given `Smuggled` value.
|
||||
|
|
@ -24,11 +27,11 @@ public extension Notification {
|
|||
/// - Returns: The extracted `Smuggled` value when found, otherwise `nil`.
|
||||
func smuggled<Contraband: Smuggled>() -> Contraband? {
|
||||
guard let instance = userInfo?[Contraband.userInfoKey] else {
|
||||
NSLog("[\(Contraband.self)] Value not found in userInfo[\"\(Contraband.userInfoKey)\"]")
|
||||
log.error("Value not found in userInfo[\"\(Contraband.userInfoKey)\"] for \(Contraband.notificationName.rawValue)")
|
||||
return nil
|
||||
}
|
||||
guard let contraband = instance as? Contraband else {
|
||||
NSLog("[\(Contraband.self)] Failed to cast \(instance) as \(Contraband.self)")
|
||||
log.error("Failed to cast \(String(describing: instance)) as \(Contraband.notificationName.rawValue)")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue