fix log counter
Summary: Log counter had a bug that only allowed the number to go up to 2. To increment the number of the last row is read and increased. However, this failed and always fall back to 1. Reviewed By: passy Differential Revision: D9613056 fbshipit-source-id: dc73990eb26c7a6ecbc70b0fe50687607b8bf0ad
This commit is contained in:
committed by
Facebook Github Bot
parent
64ff6eb9cf
commit
ace800ad55
@@ -290,8 +290,7 @@ export default class LogTable extends SonarDevicePlugin<LogsState> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
this.device.addLogListener((entry: DeviceLogEntry) => {
|
this.device.addLogListener((entry: DeviceLogEntry) => {
|
||||||
const {icon, style} =
|
const {icon, style} = LOG_TYPES[(entry.type: string)] || LOG_TYPES.debug;
|
||||||
LOG_TYPES[(entry.type: string)] || LOG_TYPES.verbose;
|
|
||||||
|
|
||||||
// clean message
|
// clean message
|
||||||
const message = entry.message.trim();
|
const message = entry.message.trim();
|
||||||
@@ -450,9 +449,16 @@ export default class LogTable extends SonarDevicePlugin<LogsState> {
|
|||||||
entry.tag === previousEntry.tag &&
|
entry.tag === previousEntry.tag &&
|
||||||
previousRow.type != null
|
previousRow.type != null
|
||||||
) {
|
) {
|
||||||
const count = (previousRow.columns.time.value.props.count || 1) + 1;
|
// duplicate log, increase counter
|
||||||
|
const count =
|
||||||
|
previousRow.columns.type.value &&
|
||||||
|
previousRow.columns.type.value.props &&
|
||||||
|
typeof previousRow.columns.type.value.props.children === 'number'
|
||||||
|
? previousRow.columns.type.value.props.children + 1
|
||||||
|
: 2;
|
||||||
|
const type = LOG_TYPES[previousRow.type] || LOG_TYPES.debug;
|
||||||
previousRow.columns.type.value = (
|
previousRow.columns.type.value = (
|
||||||
<LogCount color={LOG_TYPES[previousRow.type].color}>{count}</LogCount>
|
<LogCount color={type.color}>{count}</LogCount>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
rows.push(row);
|
rows.push(row);
|
||||||
|
|||||||
Reference in New Issue
Block a user