OSLog 实例
OSLog
let logDebug = OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "â ï¸ debug")
os_log("%@", log: logDebug, type: OSLogType.debug, String(format:message, arguments: formatArgs))
system_logs.logarchive
log
,如果我检查 直接通过 grep 或 vim ,消息存在。所以他们在日志里,但出于某种原因控制台.app也没有 日志 会给他们看的。我确定了控制台.app设置为显示“所有邮件”,我尚未输入任何搜索词。
grep
vim
日志
我遗漏了哪一步,或者哪些细节需要有所不同?
看来你没有运气 OSLogType.debug . 控制台无法显示此类日志。
OSLogType.debug
请尝试然后在控制台应用程序中检查它们。 os_log("%@", log: logDebug, type: OSLogType.info, String(format:"%i", arguments: [1]))
os_log("%@", log: logDebug, type: OSLogType.info, String(format:"%i", arguments: [1]))
os_log("%@", log: logDebug, type: OSLogType.error, String(format:"%i", arguments: [1]))
偶数:
os_log("%@", log: logDebug, type: OSLogType.default, String(format:"%i", arguments: [6]))