mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2025-01-22 10:11:39 +01:00
expand all parents of item that has an error
This commit is contained in:
parent
ac9c244315
commit
30c0da3cd7
@ -49,12 +49,26 @@ function filterValues(values: LogItemValues): LogItemValues | null {
|
|||||||
}, null);
|
}, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hasChildWithError(item: LogItem): boolean {
|
||||||
|
if (item.error) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (item.children) {
|
||||||
|
for(const c of item.children) {
|
||||||
|
if (hasChildWithError(c)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function printToConsole(item: LogItem): void {
|
function printToConsole(item: LogItem): void {
|
||||||
const label = `${itemCaption(item)} (@${item.start}ms, duration: ${item.duration}ms)`;
|
const label = `${itemCaption(item)} (@${item.start}ms, duration: ${item.duration}ms)`;
|
||||||
const filteredValues = filterValues(item.values);
|
const filteredValues = filterValues(item.values);
|
||||||
const shouldGroup = item.children || filteredValues;
|
const shouldGroup = item.children || filteredValues;
|
||||||
if (shouldGroup) {
|
if (shouldGroup) {
|
||||||
if (item.error) {
|
if (hasChildWithError(item)) {
|
||||||
console.group(label);
|
console.group(label);
|
||||||
} else {
|
} else {
|
||||||
console.groupCollapsed(label);
|
console.groupCollapsed(label);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user