Objective C 如何将 NSLog 分类为错误、警告、消息和故障类型

How to categorise NSLog into Error, Warnings, Message and Fault type in Objective C

我们正在开发 iOS 应用程序。我们想创建 NSLog 的自定义 Class,它将定义四种类型的消息 iOS 应用程序系统,如

1. Error
2. Fault
3. Info message
4. Warnings

是否有一些 Apple 标准文档来创建此类消息定义或如何为我们的 App 日志消息创建特殊情况?

NSLog()无法做到这一点。

如果您想使用日志级别,您应该在 iOS 10+ 上使用 libtrace 中的 os_log() 或在早期版本上使用 ASL。

https://developer.apple.com/documentation/os/logging