mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Do not filter errors/warnings from console
Summary: ## Overview When I implemented `ignoreLogs` it was originally just to move `console.ignoreYellowBox` over to LogBox. When I did that, I also added filtering for console messages too. My thought process was: Developers probably don't want to configure hiding logs twice, so the LogBox method can handle both. This was a mistake. We should never hide console errors and warnings, because it completely silences important feedback to the users such as deprecation warnings. These issues should be fixed, not silenced, and since adding the silencing behavior it's clear that this feature is being abused to ignore legitimate warnings that need address. Issue #33557 is a great reason why - the correct fix for this is not to ignore the errors, it's to address the deprecation / removal of the API. Allowing an easy `ignoreLog` method to hide the problem made this migration much more painful. Thus, we're reverting back to the pre-logbox behavior of always showing console logs, even if they're ignored by LogBox in the app UI. Hopefully, this results in more of these issue being addressed instead of ignored. Changelog: [General] [Changed] - Do not filter errors/warnings from console Reviewed By: yungsters Differential Revision: D40724661 fbshipit-source-id: de3d2db1b0c32dee96acf92c9b1ca07ba0f4e218
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3982a2c6bd
commit
fa2842d113
@@ -143,6 +143,9 @@ if (__DEV__) {
|
||||
if (LogBoxData.isLogBoxErrorMessage(String(args[0]))) {
|
||||
originalConsoleError(...args);
|
||||
return;
|
||||
} else {
|
||||
// Be sure to pass LogBox warnings through.
|
||||
originalConsoleWarn(...args);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -150,9 +153,6 @@ if (__DEV__) {
|
||||
const {category, message, componentStack} = parseLogBoxLog(args);
|
||||
|
||||
if (!LogBoxData.isMessageIgnored(message.content)) {
|
||||
// Be sure to pass LogBox warnings through.
|
||||
originalConsoleWarn(...args);
|
||||
|
||||
LogBoxData.addLog({
|
||||
level: 'warn',
|
||||
category,
|
||||
@@ -205,12 +205,12 @@ if (__DEV__) {
|
||||
args[0] = `Warning: ${filterResult.finalFormat}`;
|
||||
const {category, message, componentStack} = parseLogBoxLog(args);
|
||||
|
||||
if (!LogBoxData.isMessageIgnored(message.content)) {
|
||||
// Interpolate the message so they are formatted for adb and other CLIs.
|
||||
// This is different than the message.content above because it includes component stacks.
|
||||
const interpolated = parseInterpolation(args);
|
||||
originalConsoleError(interpolated.message.content);
|
||||
// Interpolate the message so they are formatted for adb and other CLIs.
|
||||
// This is different than the message.content above because it includes component stacks.
|
||||
const interpolated = parseInterpolation(args);
|
||||
originalConsoleError(interpolated.message.content);
|
||||
|
||||
if (!LogBoxData.isMessageIgnored(message.content)) {
|
||||
LogBoxData.addLog({
|
||||
level,
|
||||
category,
|
||||
|
||||
Reference in New Issue
Block a user