React Native中的发布模式诊断 [英] Release mode diagnostics in 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屋!