Skip to content

Commit

Permalink
Don't wrap console methods for metro logging in Chrome debugger
Browse files Browse the repository at this point in the history
Summary:
This diff fixes an issue reported in facebook#26788 where logs in the Chrome console were showing a different location than previous versions.

In the change here, we stop wrapping the console functions to attach the metro websocket in any environment that isn't a native app environment. We do this by checking `global.nativeLoggingHook` which is bound only by native apps and not environments like the Chrome DevTools.

Differential Revision: D17951707

fbshipit-source-id: 64b143c4d256e6ab13150dad2702b12cc4500391
  • Loading branch information
rickhanlonii authored and facebook-github-bot committed Oct 16, 2019
1 parent 0d1b9b5 commit 77acfd7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Libraries/Core/setUpDeveloperTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ if (__DEV__) {
JSInspector.registerAgent(require('../JSInspector/NetworkAgent'));
}

if (!Platform.isTesting) {
// Only attach metro logging if we're in a native app environment,
// otherwise continue to use the native logging for the envionment we're in.
if (!Platform.isTesting && global.nativeLoggingHook) {
const HMRClient = require('../Utilities/HMRClient');
[
'trace',
Expand Down

0 comments on commit 77acfd7

Please sign in to comment.