mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-22 19:14:52 +01:00
log pagehide event
This commit is contained in:
parent
cfc17ad176
commit
f2f9162b85
@ -23,6 +23,12 @@ export class BaseLogger {
|
||||
this._platform = platform;
|
||||
}
|
||||
|
||||
log(labelOrValues, logLevel = LogLevel.Info) {
|
||||
const item = new LogItem(labelOrValues, logLevel, null, this._platform.clock);
|
||||
item._end = item._start;
|
||||
this._persistItem(item.serialize(null));
|
||||
}
|
||||
|
||||
run(labelOrValues, callback, logLevel = LogLevel.Info, filterCreator = null) {
|
||||
const item = new LogItem(labelOrValues, logLevel, null, this._platform.clock);
|
||||
this._openItems.add(item);
|
||||
@ -31,7 +37,7 @@ export class BaseLogger {
|
||||
let filter = new LogFilter();
|
||||
if (filterCreator) {
|
||||
try {
|
||||
filter = filterCreator(filter, this);
|
||||
filter = filterCreator(filter, item);
|
||||
} catch (err) {
|
||||
console.error("Error while creating log filter", err);
|
||||
}
|
||||
|
@ -82,6 +82,7 @@ export class IDBLogger extends BaseLogger {
|
||||
|
||||
_finishAllAndFlush() {
|
||||
this._finishOpenItems();
|
||||
this.log({l: "pagehide, closing logs", t: "navigation"});
|
||||
this._persistQueuedItems(this._queuedItems);
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ export class LogItem {
|
||||
return array;
|
||||
}, null);
|
||||
}
|
||||
if (!filter.filter(this, children)) {
|
||||
if (filter && !filter.filter(this, children)) {
|
||||
return null;
|
||||
}
|
||||
// in (v)alues, (l)abel and (t)ype are also reserved.
|
||||
|
Loading…
Reference in New Issue
Block a user