本文介绍了使用Console.app更改iOS 10(统一日志记录)上的日志级别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这很简单但是:如果我尝试使用iOS10的新统一记录和活动跟踪API,我究竟如何设置我在Console.app中看到的日志消息的级别?



换句话说,如果我在iOS上运行代码如下:

  fileprivate let logger = OSLog(子系统:Bundle.main.bundleIdentifier!,category:mycategory)

fileprivate func logv(_ s:String){
os_log(%@,log:记录器,输入:.info,s)
}

然后我需要做什么在Console.app中查看记录的消息?默认情况下,只显示 .error 类型的日志消息。



我想知道如何执行此操作如果我在设备上运行代码,而不是在模拟器中运行。



相关:




This is so simple but: how on earth do I set the level of log messages I see in Console.app, if I am trying to use iOS10's new "Unified Logging & Activity Tracing" API?

In other words, if I have code running on iOS like so:

fileprivate let logger = OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "mycategory")

fileprivate func logv(_ s:String) {
    os_log("%@",log:logger,type:.info,s)
}

Then what do I need to do to see the logged messages in Console.app? By default, only log messages of type .error seem to show up.

I am wondering how to do this if I am running code on a device, not in the simulator.

Related:

Xcode 8 - os_log_debug and os_log_info logs are not displayed on new Mac console (unified logging)

解决方案

Hilariously, the answer is that you just go to the Console.app's menu bar and select:

  • Action / Include Info Messages
  • Action / Include Debug Messages

这篇关于使用Console.app更改iOS 10(统一日志记录)上的日志级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 16:19