diff --git a/src/logging/IDBLogger.ts b/src/logging/IDBLogger.ts index d5ce2f9a..dcfd3a64 100644 --- a/src/logging/IDBLogger.ts +++ b/src/logging/IDBLogger.ts @@ -118,7 +118,7 @@ export class IDBLogger extends BaseLogger { } _persistItem(logItem: ILogItem, filter: LogFilter, forced: boolean): void { - const serializedItem = logItem.serialize(filter, null, forced); + const serializedItem = logItem.serialize(filter, undefined, forced); this._queuedItems.push({ json: JSON.stringify(serializedItem) }); diff --git a/src/logging/LogItem.ts b/src/logging/LogItem.ts index 012abc57..82f785e4 100644 --- a/src/logging/LogItem.ts +++ b/src/logging/LogItem.ts @@ -53,7 +53,7 @@ export interface ILogItem { catch(err: Error): Error; finish(): void; child(labelOrValues: LabelOrValues, logLevel?: LogLevel, filterCreator?: FilterCreator): ILogItem; - serialize(filter: LogFilter, parentStartTime: number | null, forced: boolean): ISerializedItem | null; + serialize(filter: LogFilter, parentStartTime: number | undefined, forced: boolean): ISerializedItem | undefined; } export type LogItemValues = { @@ -171,7 +171,7 @@ export class LogItem implements ILogItem { } // todo: null or undefined here? - serialize(filter: LogFilter, parentStartTime: number | null = null, forced: boolean): ISerializedItem | null { + serialize(filter: LogFilter, parentStartTime: number | undefined, forced: boolean): ISerializedItem | undefined { if (this._filterCreator) { try { filter = this._filterCreator(new LogFilter(filter), this); @@ -193,12 +193,12 @@ export class LogItem implements ILogItem { }, null); } if (filter && !filter.filter(this, children)) { - return null; + return; } // in (v)alues, (l)abel and (t)ype are also reserved. const item: ISerializedItem = { // (s)tart - s: parentStartTime === null ? this.start : this.start - parentStartTime, + s: parentStartTime? this.start - parentStartTime : this.start, // (d)uration d: this.duration, // (v)alues diff --git a/src/logging/NullLogger.ts b/src/logging/NullLogger.ts index 601a1c39..63e91f61 100644 --- a/src/logging/NullLogger.ts +++ b/src/logging/NullLogger.ts @@ -102,7 +102,7 @@ export class NullLogItem implements ILogItem { finish(): void {} serialize() { - return null; + return undefined; } }