How to set logging levels on Android to respond to native?

I went through my own code and found the following code in one of the files:

#define RCTLog(...) _RCTLog(RCTLogLevelInfo, __VA_ARGS__) #define RCTLogTrace(...) _RCTLog(RCTLogLevelTrace, __VA_ARGS__) #define RCTLogInfo(...) _RCTLog(RCTLogLevelInfo, __VA_ARGS__) #define RCTLogWarn(...) _RCTLog(RCTLogLevelWarning, __VA_ARGS__) #define RCTLogError(...) _RCTLog(RCTLogLevelError, __VA_ARGS__) 

I was wondering if there is something similar (in the answer to the native one) for Android. I tried fishing through the reactive code but couldn't find a way to do this. I was wondering if anyone needs to do this for Android.

Can someone please help me with this?

+7
logging reactjs react-native react-native-android react-native-ios
source share
3 answers

React-native uses Yoga under the hood to display their log message on the screen. I was unable to find a library that does the same for an Android app. There are many libraries that display a message on the screen that you can use to display your log message. The internal reaction is native, the log component is built from objective-c code, so you cannot access it from java. In the past few days, I have been trying to find something similar, but I could not. There are also many tools to help you log all the information, but the log is always displayed on the console.

0
source share

It may be too late for this, but you can use response-native-android-log (I am the author).

Example:

 import Log from 'react-native-android-log' // Set the default level (optional) Log.setLevel(__DEV__ ? Log.VERBOSE : Log.WARN) ... Log.v('Verbose message') // no output in release builds Log.w('Debugging') 

... and see the output in the console via adb:

 $ adb logcat -s App:V 

... or in the EXIT panel of the VS code.

Please check out the README package, there you will find how to configure and use it.

0
source share

I used some external libraries / APIs that I could not debug using standard logs.

Enter

 window.LOG_LEVEL = 'DEBUG' 

at the top of App.js printed external logs, which allowed me to debug my problem. I think there are other levels of logs that you can also pass to the window.

0
source share

All Articles