React Native中的发布模式诊断 [英] Release mode diagnostics in React Native

查看:97
本文介绍了React Native中的发布模式诊断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何方法可以让React Native将所有console.log调用输出到同一位置NSLog去?

Is there any way to get React Native to output all console.log calls to same place NSLog goes?

在发布模式下,是否可以查看console.log的输出?

Is there a way I can see the outputs from console.log in Release mode?

如果没有,我可以使用NSLog助手来响应本机吗?

If not is there an NSLog helper for react native I can use?

(请注意,我知道在调试"模式下我可以通过多种方式获取此信息,但是我需要诊断的发布"模式存在特定问题.)

(note I know that in Debug mode I have a multitude of ways of getting this info, but I am having specific issue with Release mode that I need to diagnose.)

推荐答案

AppDelegate.m

#import <React/RCTLog.h>

然后在didFinishLaunchingWithOptions

RCTSetLogThreshold(RCTLogLevelInfo - 1);

这将react logger设置为将所有级别记录到NSLog,而不是默认的发布版本:RCTLogLevelError这是console.error我猜是:)

This sets the react logger to log all levels to NSLog as opposed to the release default which is: RCTLogLevelError which is console.error I guess :)

这使您可以构建一个完全诚实的发布"模式,并包含所有想要的详细日志记录.

This allows you to have a totally honest "release" mode build with all the verbose logging you want.

这篇关于React Native中的发布模式诊断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆