A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://reactnative.dev/docs/next/debugging-native-code below:

Debugging Native Code · React Native

If you are writing a Native Module and want to add custom logs to your module for debugging purposes, you can use the following method:

Android (Java/Kotlin)

In your native module, use the Log class to add logs that can be viewed in Logcat:

java

import android.util.Log;

private void log(String message) {
Log.d("YourModuleName", message);
}

To view these logs in Logcat, use this command, replacing YourModuleName with your custom tag:

shell

adb logcat "*:S" ReactNative:V ReactNativeJS:V YourModuleName:D
iOS (Objective-C/Swift)

In your native module, use NSLog for custom logs:

objective-c

NSLog(@"YourModuleName: %@", message);

Or, in Swift:

swift

print("YourModuleName: \(message)")

These logs will appear in the Xcode console when running the app.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4