import OSLog // Create an extenstion for Logger class provided by swift extension Logger { /// Using app bundle identifier to make your log unique to your app when view console. private static var bundleId = Bundle.main.bundleIdentifier! /// Create a logger to catgorize the log. static let analytics = Logger(subsystem: Logger.bundleId, category: "tracking") } Using the logger based on log-level Logger.analytics.info("View DidLoad!") Logger.analytics.debug("Object info \(obj.name)") Refrence: https://developer.apple.com/documentation/os/logger