mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Mark nullability of RNLog class (#42865)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/42865 Mark nullability of RNLog class changelog: [internal] internal Reviewed By: cortinico Differential Revision: D53393953 fbshipit-source-id: 122e7be226170af36793664a646585b16ec2d305
This commit is contained in:
committed by
Facebook GitHub Bot
parent
4dcc1d3efb
commit
e2fa62d6ad
@@ -11,6 +11,7 @@ import android.util.Log;
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/** Logging wrapper for FLog with LogBox support. */
|
||||
public class RNLog {
|
||||
@@ -60,7 +61,7 @@ public class RNLog {
|
||||
* @param context The React context of the application use to display the warning.
|
||||
* @param message The message to log.
|
||||
*/
|
||||
public static void w(ReactContext context, String message) {
|
||||
public static void w(@Nullable ReactContext context, String message) {
|
||||
logInternal(context, message, WARN);
|
||||
FLog.w(ReactConstants.TAG, message);
|
||||
}
|
||||
@@ -71,7 +72,7 @@ public class RNLog {
|
||||
* @param context The React context of the application use to display the error.
|
||||
* @param message The message to log.
|
||||
*/
|
||||
public static void e(ReactContext context, String message) {
|
||||
public static void e(@Nullable ReactContext context, String message) {
|
||||
logInternal(context, message, ERROR);
|
||||
FLog.e(ReactConstants.TAG, message);
|
||||
}
|
||||
@@ -86,7 +87,8 @@ public class RNLog {
|
||||
FLog.e(ReactConstants.TAG, message);
|
||||
}
|
||||
|
||||
private static void logInternal(ReactContext context, String message, int level) {
|
||||
private static void logInternal(
|
||||
@Nullable ReactContext context, @Nullable String message, int level) {
|
||||
if (level >= MINIMUM_LEVEL_FOR_UI) {
|
||||
if (context != null && context.hasActiveReactInstance() && message != null) {
|
||||
context.getJSModule(RCTLog.class).logIfNoNativeHook(levelToString(level), message);
|
||||
|
||||
Reference in New Issue
Block a user