@samitouri / QOS-React-2 / commits / 2245206c4c

Add source location to debug logging info

Brian Vaughn committed Jun 4, 2019 at 08:56 UTC 2245206c4ce7b5c47ba67e677ca7e9127b8c2926
3 files changed +11 -3
src/backend/renderer.js
+4 -1
@@ -1925,7 +1925,7 @@ export function attach(
1925 owners,
1926
1927 // Location of component in source coude.
1928 - source: _debugSource,
1928 + source: _debugSource || null,
1929 };
1930 }
1931
@@ -1986,6 +1986,9 @@ export function attach(
1986 if (nativeNodes !== null) {
1987 console.log('Nodes:', nativeNodes);
1988 }
1989 + if (result.source !== null) {
1990 + console.log('Location:', result.source);
1991 + }
1992 if (window.chrome || /firefox/i.test(navigator.userAgent)) {
1993 console.log(
1994 'Right-click any value to save it as a global variable for further inspection.'
src/backend/types.js
+1 -1
@@ -191,7 +191,7 @@ export type InspectedElement = {|
191 owners: Array<Owner> | null,
192
193 // Location of component in source coude.
194 - source: Object | null,
194 + source: Source | null,
195
196 type: ElementType,
197 |};
src/devtools/views/Components/types.js
+6 -1
@@ -44,6 +44,11 @@ export type OwnersList = {|
44 owners: Array<Owner> | null,
45 |};
46
47 +export type Source = {|
48 + fileName: string,
49 + lineNumber: number,
50 +|};
51 +
52 export type InspectedElement = {|
53 id: number,
54
@@ -72,7 +77,7 @@ export type InspectedElement = {|
77 owners: Array<Owner> | null,
78
79 // Location of component in source coude.
75 - source: Object | null,
80 + source: Source | null,
81
82 type: ElementType,
83 |};