Is there any way to get React Native to output all console.log
calls to same place NSLog
goes?
Is there a way I can see the outputs from console.log
in Release mode?
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.)
Connecting a React Native app to React Native Debugger To connect your app with React Native Debugger, you need to run your app and start debug mode. To start debug mode, shake your mobile device or press Command + Shift + Z or Ctrl + M and choose the debug option. We're all set to begin using React Native Debugger.
You can access the developer menu by shaking your device or by selecting "Shake Gesture" inside the Hardware menu in the iOS Simulator. You can also use the ⌘D keyboard shortcut when your app is running in the iOS Simulator, or ⌘M when running in an Android emulator on macOS and Ctrl+M on Windows and Linux.
Bundling. Most React apps will have their files “bundled” using tools like Webpack, Rollup or Browserify. Bundling is the process of following imported files and merging them into a single file: a “bundle”. This bundle can then be included on a webpage to load an entire app at once.
In AppDelegate.m
#import <React/RCTLog.h>
Then in didFinishLaunchingWithOptions
RCTSetLogThreshold(RCTLogLevelInfo - 1);
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With