Skip to content

Commit

Permalink
In the logger, only combine outputs if they have the same second (whi…
Browse files Browse the repository at this point in the history
…ch is the resolution for our timestamp).

This means that visually, we are telling the truth with the timestamp - every message displayed with that time is the same time, to the resolution of the display (which is one second).
  • Loading branch information
jasongrout committed Oct 31, 2019
1 parent d59af07 commit c0ce902
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/logconsole/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,24 @@ export class LoggerOutputAreaModel extends OutputAreaModel
return this.length;
}

/**
* Whether an output should combine with the previous output.
*
* We combine if the two outputs are in the same second, which is the
* resolution for our time display.
*/
protected shouldCombine(options: {
value: ILogOutput;
lastModel: ILogOutputModel;
}): boolean {
const { value, lastModel } = options;

let oldSeconds = Math.trunc(lastModel.timestamp.getTime() / 1000);
let newSeconds = Math.trunc(value.timestamp / 1000);

return oldSeconds === newSeconds;
}

/**
* Get an item at the specified index.
*/
Expand Down

0 comments on commit c0ce902

Please sign in to comment.