From 94845eb55cb6847d76390e336546c61f2ac9fa40 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Fri, 6 Jun 2025 16:39:20 -0700 Subject: [PATCH] Use os.log instead of NSLog --- Sources/NotificationSmuggling/Smuggling.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Sources/NotificationSmuggling/Smuggling.swift b/Sources/NotificationSmuggling/Smuggling.swift index be81b1a..414b8e2 100644 --- a/Sources/NotificationSmuggling/Smuggling.swift +++ b/Sources/NotificationSmuggling/Smuggling.swift @@ -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? { 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 }