Skip to content

Commit

Permalink
Remove Warning: prefix and toString on console Arguments (#29839)
Browse files Browse the repository at this point in the history
Basically make `console.error` and `console.warn` behave like normal -
when a component stack isn't appended. I need this because I need to be
able to print rich logs with the component stack option and to be able
to disable instrumentation completely in `console.createTask`
environments that don't need it.

Currently we can't print logs with richer objects because they're
toString:ed first. In practice, pretty much all arguments we log are
already toString:ed so it's not necessary anyway. Some might be like a
number. So it would only be a problem if some environment can't handle
proper consoles but then it's up to that environment to toString it
before logging.

The `Warning: ` prefix is historic and is both noisy and confusing. It's
mostly unnecessary since the UI surrounding `console.error` and
`console.warn` tend to have visual treatment around it anyway. However,
it's actively misleading when `console.error` gets prefixed with a
Warning that we consider an error level. There's an argument to be made
that some of our `console.error` don't make the bar for an error but
then the argument is to downgrade each of those to `console.warn` - not
to brand all our actual error logging with `Warning: `.

Apparently something needs to change in React Native before landing this
because it depends on the prefix somehow which probably doesn't make
sense already.

DiffTrain build for [2774208](2774208)
  • Loading branch information
sebmarkbage committed Jun 10, 2024
1 parent fcd1411 commit 08b8f37
Show file tree
Hide file tree
Showing 35 changed files with 97 additions and 97 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c2ae9e28bc02fdd29c46b247d908e6b467ef06af
277420803947724b43c47bbc47d3a353553868f1
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION_TRANSFORMS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c2ae9e28bc02fdd29c46b247d908e6b467ef06af
277420803947724b43c47bbc47d3a353553868f1
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -1980,7 +1980,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.0.0-www-classic-c2ae9e28bc-20240608";
exports.version = "19.0.0-www-classic-2774208039-20240610";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -1960,7 +1960,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.0.0-www-modern-c2ae9e28bc-20240608";
exports.version = "19.0.0-www-modern-2774208039-20240610";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -665,4 +665,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-classic-c2ae9e28bc-20240608";
exports.version = "19.0.0-www-classic-2774208039-20240610";
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -665,4 +665,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-modern-c2ae9e28bc-20240608";
exports.version = "19.0.0-www-modern-2774208039-20240610";
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-profiling.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-classic-c2ae9e28bc-20240608";
exports.version = "19.0.0-www-classic-2774208039-20240610";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-profiling.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-modern-c2ae9e28bc-20240608";
exports.version = "19.0.0-www-modern-2774208039-20240610";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -16922,14 +16922,14 @@ __DEV__ &&
scheduleRoot: scheduleRoot,
setRefreshHandler: setRefreshHandler,
getCurrentFiber: getCurrentFiberForDevTools,
reconcilerVersion: "19.0.0-www-classic-c2ae9e28bc-20240608"
reconcilerVersion: "19.0.0-www-classic-2774208039-20240610"
});
})({
findFiberByHostInstance: function () {
return null;
},
bundleType: 1,
version: "19.0.0-www-classic-c2ae9e28bc-20240608",
version: "19.0.0-www-classic-2774208039-20240610",
rendererPackageName: "react-art"
});
var ClippingRectangle = TYPES.CLIPPING_RECTANGLE,
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactART-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -16362,14 +16362,14 @@ __DEV__ &&
scheduleRoot: scheduleRoot,
setRefreshHandler: setRefreshHandler,
getCurrentFiber: getCurrentFiberForDevTools,
reconcilerVersion: "19.0.0-www-modern-c2ae9e28bc-20240608"
reconcilerVersion: "19.0.0-www-modern-2774208039-20240610"
});
})({
findFiberByHostInstance: function () {
return null;
},
bundleType: 1,
version: "19.0.0-www-modern-c2ae9e28bc-20240608",
version: "19.0.0-www-modern-2774208039-20240610",
rendererPackageName: "react-art"
});
var ClippingRectangle = TYPES.CLIPPING_RECTANGLE,
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactART-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -10686,7 +10686,7 @@ var slice = Array.prototype.slice,
return null;
},
bundleType: 0,
version: "19.0.0-www-classic-c2ae9e28bc-20240608",
version: "19.0.0-www-classic-2774208039-20240610",
rendererPackageName: "react-art"
};
var internals$jscomp$inline_1371 = {
Expand Down Expand Up @@ -10717,7 +10717,7 @@ var internals$jscomp$inline_1371 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-www-classic-c2ae9e28bc-20240608"
reconcilerVersion: "19.0.0-www-classic-2774208039-20240610"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1372 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactART-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -10149,7 +10149,7 @@ var slice = Array.prototype.slice,
return null;
},
bundleType: 0,
version: "19.0.0-www-modern-c2ae9e28bc-20240608",
version: "19.0.0-www-modern-2774208039-20240610",
rendererPackageName: "react-art"
};
var internals$jscomp$inline_1357 = {
Expand Down Expand Up @@ -10180,7 +10180,7 @@ var internals$jscomp$inline_1357 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-www-modern-c2ae9e28bc-20240608"
reconcilerVersion: "19.0.0-www-modern-2774208039-20240610"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1358 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
18 changes: 9 additions & 9 deletions compiled/facebook-www/ReactDOM-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -2110,14 +2110,14 @@ __DEV__ &&
(parentInfo +=
" Add a <tbody>, <thead> or <tfoot> to your code to match the DOM tree generated by the browser."),
console.error(
"Warning: In HTML, %s cannot be a child of <%s>.%s\nThis will cause a hydration error.%s",
"In HTML, %s cannot be a child of <%s>.%s\nThis will cause a hydration error.%s",
warnKey,
ancestorInfo,
parentInfo,
getCurrentParentStackInDev()
))
: console.error(
"Warning: In HTML, %s cannot be a descendant of <%s>.\nThis will cause a hydration error.%s",
"In HTML, %s cannot be a descendant of <%s>.\nThis will cause a hydration error.%s",
warnKey,
ancestorInfo,
getCurrentParentStackInDev()
Expand All @@ -2131,12 +2131,12 @@ __DEV__ &&
didWarn[warnKey] = !0;
/\S/.test(childText)
? console.error(
"Warning: In HTML, text nodes cannot be a child of <%s>.\nThis will cause a hydration error.%s",
"In HTML, text nodes cannot be a child of <%s>.\nThis will cause a hydration error.%s",
parentTag,
getCurrentParentStackInDev()
)
: console.error(
"Warning: In HTML, whitespace text nodes cannot be a child of <%s>. Make sure you don't have any extra whitespace between tags on each line of your source code.\nThis will cause a hydration error.%s",
"In HTML, whitespace text nodes cannot be a child of <%s>. Make sure you don't have any extra whitespace between tags on each line of your source code.\nThis will cause a hydration error.%s",
parentTag,
getCurrentParentStackInDev()
);
Expand Down Expand Up @@ -27338,11 +27338,11 @@ __DEV__ &&
: flushSyncErrorInBuildsThatSupportLegacyMode;
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.0.0-www-classic-c2ae9e28bc-20240608" !== isomorphicReactPackageVersion)
if ("19.0.0-www-classic-2774208039-20240610" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-dom: 19.0.0-www-classic-c2ae9e28bc-20240608\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.0.0-www-classic-2774208039-20240610\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
Expand Down Expand Up @@ -27408,12 +27408,12 @@ __DEV__ &&
scheduleRoot: scheduleRoot,
setRefreshHandler: setRefreshHandler,
getCurrentFiber: getCurrentFiberForDevTools,
reconcilerVersion: "19.0.0-www-classic-c2ae9e28bc-20240608"
reconcilerVersion: "19.0.0-www-classic-2774208039-20240610"
});
})({
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 1,
version: "19.0.0-www-classic-c2ae9e28bc-20240608",
version: "19.0.0-www-classic-2774208039-20240610",
rendererPackageName: "react-dom"
}) &&
canUseDOM &&
Expand Down Expand Up @@ -28084,7 +28084,7 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.0.0-www-classic-c2ae9e28bc-20240608";
exports.version = "19.0.0-www-classic-2774208039-20240610";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
18 changes: 9 additions & 9 deletions compiled/facebook-www/ReactDOM-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -2080,14 +2080,14 @@ __DEV__ &&
(parentInfo +=
" Add a <tbody>, <thead> or <tfoot> to your code to match the DOM tree generated by the browser."),
console.error(
"Warning: In HTML, %s cannot be a child of <%s>.%s\nThis will cause a hydration error.%s",
"In HTML, %s cannot be a child of <%s>.%s\nThis will cause a hydration error.%s",
warnKey,
ancestorInfo,
parentInfo,
getCurrentParentStackInDev()
))
: console.error(
"Warning: In HTML, %s cannot be a descendant of <%s>.\nThis will cause a hydration error.%s",
"In HTML, %s cannot be a descendant of <%s>.\nThis will cause a hydration error.%s",
warnKey,
ancestorInfo,
getCurrentParentStackInDev()
Expand All @@ -2101,12 +2101,12 @@ __DEV__ &&
didWarn[warnKey] = !0;
/\S/.test(childText)
? console.error(
"Warning: In HTML, text nodes cannot be a child of <%s>.\nThis will cause a hydration error.%s",
"In HTML, text nodes cannot be a child of <%s>.\nThis will cause a hydration error.%s",
parentTag,
getCurrentParentStackInDev()
)
: console.error(
"Warning: In HTML, whitespace text nodes cannot be a child of <%s>. Make sure you don't have any extra whitespace between tags on each line of your source code.\nThis will cause a hydration error.%s",
"In HTML, whitespace text nodes cannot be a child of <%s>. Make sure you don't have any extra whitespace between tags on each line of your source code.\nThis will cause a hydration error.%s",
parentTag,
getCurrentParentStackInDev()
);
Expand Down Expand Up @@ -26495,11 +26495,11 @@ __DEV__ &&
return_targetInst = null;
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.0.0-www-modern-c2ae9e28bc-20240608" !== isomorphicReactPackageVersion)
if ("19.0.0-www-modern-2774208039-20240610" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-dom: 19.0.0-www-modern-c2ae9e28bc-20240608\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.0.0-www-modern-2774208039-20240610\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
Expand Down Expand Up @@ -26564,12 +26564,12 @@ __DEV__ &&
scheduleRoot: scheduleRoot,
setRefreshHandler: setRefreshHandler,
getCurrentFiber: getCurrentFiberForDevTools,
reconcilerVersion: "19.0.0-www-modern-c2ae9e28bc-20240608"
reconcilerVersion: "19.0.0-www-modern-2774208039-20240610"
});
})({
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 1,
version: "19.0.0-www-modern-c2ae9e28bc-20240608",
version: "19.0.0-www-modern-2774208039-20240610",
rendererPackageName: "react-dom"
}) &&
canUseDOM &&
Expand Down Expand Up @@ -27171,7 +27171,7 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.0.0-www-modern-c2ae9e28bc-20240608";
exports.version = "19.0.0-www-modern-2774208039-20240610";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
10 changes: 5 additions & 5 deletions compiled/facebook-www/ReactDOM-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -17126,14 +17126,14 @@ function getCrossOriginStringAs(as, input) {
}
var isomorphicReactPackageVersion$jscomp$inline_1754 = React.version;
if (
"19.0.0-www-classic-c2ae9e28bc-20240608" !==
"19.0.0-www-classic-2774208039-20240610" !==
isomorphicReactPackageVersion$jscomp$inline_1754
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1754,
"19.0.0-www-classic-c2ae9e28bc-20240608"
"19.0.0-www-classic-2774208039-20240610"
)
);
function flushSyncFromReconciler(fn) {
Expand Down Expand Up @@ -17179,7 +17179,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1761 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "19.0.0-www-classic-c2ae9e28bc-20240608",
version: "19.0.0-www-classic-2774208039-20240610",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2205 = {
Expand Down Expand Up @@ -17209,7 +17209,7 @@ var internals$jscomp$inline_2205 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-www-classic-c2ae9e28bc-20240608"
reconcilerVersion: "19.0.0-www-classic-2774208039-20240610"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2206 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -17692,4 +17692,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.0.0-www-classic-c2ae9e28bc-20240608";
exports.version = "19.0.0-www-classic-2774208039-20240610";
10 changes: 5 additions & 5 deletions compiled/facebook-www/ReactDOM-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -16451,14 +16451,14 @@ function getCrossOriginStringAs(as, input) {
}
var isomorphicReactPackageVersion$jscomp$inline_1725 = React.version;
if (
"19.0.0-www-modern-c2ae9e28bc-20240608" !==
"19.0.0-www-modern-2774208039-20240610" !==
isomorphicReactPackageVersion$jscomp$inline_1725
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1725,
"19.0.0-www-modern-c2ae9e28bc-20240608"
"19.0.0-www-modern-2774208039-20240610"
)
);
Internals.findDOMNode = function (componentOrElement) {
Expand All @@ -16477,7 +16477,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1727 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "19.0.0-www-modern-c2ae9e28bc-20240608",
version: "19.0.0-www-modern-2774208039-20240610",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2196 = {
Expand Down Expand Up @@ -16507,7 +16507,7 @@ var internals$jscomp$inline_2196 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-www-modern-c2ae9e28bc-20240608"
reconcilerVersion: "19.0.0-www-modern-2774208039-20240610"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2197 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -16881,4 +16881,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.0.0-www-modern-c2ae9e28bc-20240608";
exports.version = "19.0.0-www-modern-2774208039-20240610";
10 changes: 5 additions & 5 deletions compiled/facebook-www/ReactDOM-profiling.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -17893,14 +17893,14 @@ function getCrossOriginStringAs(as, input) {
}
var isomorphicReactPackageVersion$jscomp$inline_1841 = React.version;
if (
"19.0.0-www-classic-c2ae9e28bc-20240608" !==
"19.0.0-www-classic-2774208039-20240610" !==
isomorphicReactPackageVersion$jscomp$inline_1841
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1841,
"19.0.0-www-classic-c2ae9e28bc-20240608"
"19.0.0-www-classic-2774208039-20240610"
)
);
function flushSyncFromReconciler(fn) {
Expand Down Expand Up @@ -17946,7 +17946,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1848 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "19.0.0-www-classic-c2ae9e28bc-20240608",
version: "19.0.0-www-classic-2774208039-20240610",
rendererPackageName: "react-dom"
};
(function (internals) {
Expand Down Expand Up @@ -17990,7 +17990,7 @@ var devToolsConfig$jscomp$inline_1848 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-www-classic-c2ae9e28bc-20240608"
reconcilerVersion: "19.0.0-www-classic-2774208039-20240610"
});
function ReactDOMRoot(internalRoot) {
this._internalRoot = internalRoot;
Expand Down Expand Up @@ -18460,7 +18460,7 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.0.0-www-classic-c2ae9e28bc-20240608";
exports.version = "19.0.0-www-classic-2774208039-20240610";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
Loading

0 comments on commit 08b8f37

Please sign in to comment.