forked from mystiq/hydrogen-web
Use undefined in LogItem.serialize
This commit is contained in:
parent
ba5f2032ba
commit
fe69f84c85
3 changed files with 6 additions and 6 deletions
|
@ -118,7 +118,7 @@ export class IDBLogger extends BaseLogger {
|
||||||
}
|
}
|
||||||
|
|
||||||
_persistItem(logItem: ILogItem, filter: LogFilter, forced: boolean): void {
|
_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({
|
this._queuedItems.push({
|
||||||
json: JSON.stringify(serializedItem)
|
json: JSON.stringify(serializedItem)
|
||||||
});
|
});
|
||||||
|
|
|
@ -53,7 +53,7 @@ export interface ILogItem {
|
||||||
catch(err: Error): Error;
|
catch(err: Error): Error;
|
||||||
finish(): void;
|
finish(): void;
|
||||||
child(labelOrValues: LabelOrValues, logLevel?: LogLevel, filterCreator?: FilterCreator): ILogItem;
|
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 = {
|
export type LogItemValues = {
|
||||||
|
@ -171,7 +171,7 @@ export class LogItem implements ILogItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: null or undefined here?
|
// 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) {
|
if (this._filterCreator) {
|
||||||
try {
|
try {
|
||||||
filter = this._filterCreator(new LogFilter(filter), this);
|
filter = this._filterCreator(new LogFilter(filter), this);
|
||||||
|
@ -193,12 +193,12 @@ export class LogItem implements ILogItem {
|
||||||
}, null);
|
}, null);
|
||||||
}
|
}
|
||||||
if (filter && !filter.filter(this, children)) {
|
if (filter && !filter.filter(this, children)) {
|
||||||
return null;
|
return;
|
||||||
}
|
}
|
||||||
// in (v)alues, (l)abel and (t)ype are also reserved.
|
// in (v)alues, (l)abel and (t)ype are also reserved.
|
||||||
const item: ISerializedItem = {
|
const item: ISerializedItem = {
|
||||||
// (s)tart
|
// (s)tart
|
||||||
s: parentStartTime === null ? this.start : this.start - parentStartTime,
|
s: parentStartTime? this.start - parentStartTime : this.start,
|
||||||
// (d)uration
|
// (d)uration
|
||||||
d: this.duration,
|
d: this.duration,
|
||||||
// (v)alues
|
// (v)alues
|
||||||
|
|
|
@ -102,7 +102,7 @@ export class NullLogItem implements ILogItem {
|
||||||
finish(): void {}
|
finish(): void {}
|
||||||
|
|
||||||
serialize() {
|
serialize() {
|
||||||
return null;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue