also remove deferred log items from open list when finishing them

otherwise they end up in the logs twice when exporting
This commit is contained in:
Bruno Windels 2022-07-05 11:02:36 +02:00
parent 6aab049052
commit 5527e2b22c

View file

@ -159,6 +159,11 @@ export class Logger implements ILogger {
this._openItems.clear(); this._openItems.clear();
} }
/** @internal */
_removeItemFromOpenList(item: LogItem): void {
this._openItems.delete(item);
}
/** @internal */ /** @internal */
_persistItem(item: LogItem, filter?: LogFilter, forced?: boolean): void { _persistItem(item: LogItem, filter?: LogFilter, forced?: boolean): void {
for (var i = 0; i < this.reporters.length; i += 1) { for (var i = 0; i < this.reporters.length; i += 1) {
@ -186,6 +191,7 @@ class DeferredPersistRootLogItem extends LogItem {
finish() { finish() {
super.finish(); super.finish();
(this._logger as Logger)._persistItem(this, undefined, false); (this._logger as Logger)._persistItem(this, undefined, false);
(this._logger as Logger)._removeItemFromOpenList(this);
} }
forceFinish() { forceFinish() {