How to do logging in React Native?
console.log
works.
By default on iOS, it logs to the debug pane inside Xcode.
From the iOS simulator, press (⌘+D) and press Remote JS Debugging. This will open a resource, http://localhost:8081/debugger-ui on localhost. From there, use the Chrome Developer tools JavaScript console to view console.log
Pre React Native 0.29, run this in the console:
adb logcat *:S ReactNative:V ReactNativeJS:V
Post React Native 0.29, run:
react-native log-ios
or
react-native log-android
As Martin said in another answer.
This shows all console.log(), errors, notes, etc. and causes zero slow down.
Use console.log
, console.warn
, etc.
As of React Native 0.29, you can simply run the following to see logs in the console:
react-native log-ios
react-native log-android