2020-07-27 08:39:21 +00:00
|
|
|
// Copyright 2020 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2020-10-19 10:13:33 +00:00
|
|
|
export class LogEntry {
|
2020-07-27 08:39:21 +00:00
|
|
|
constructor(type, time) {
|
2020-10-19 10:45:42 +00:00
|
|
|
this._time = time;
|
|
|
|
this._type = type;
|
2020-12-03 17:48:45 +00:00
|
|
|
this.sourcePosition = undefined;
|
2020-07-27 08:39:21 +00:00
|
|
|
}
|
2020-12-03 17:48:45 +00:00
|
|
|
|
2020-08-25 06:31:43 +00:00
|
|
|
get time() {
|
2020-10-19 10:45:42 +00:00
|
|
|
return this._time;
|
2020-07-27 08:39:21 +00:00
|
|
|
}
|
2020-12-03 17:48:45 +00:00
|
|
|
|
2020-08-25 06:31:43 +00:00
|
|
|
get type() {
|
2020-10-19 10:45:42 +00:00
|
|
|
return this._type;
|
2020-07-27 08:39:21 +00:00
|
|
|
}
|
2020-12-03 17:48:45 +00:00
|
|
|
|
2020-12-07 08:44:54 +00:00
|
|
|
get script() {
|
|
|
|
return this.sourcePosition?.script;
|
|
|
|
}
|
|
|
|
|
|
|
|
toString() {
|
2021-05-25 08:49:11 +00:00
|
|
|
let name = this.constructor.name;
|
|
|
|
const index = name.lastIndexOf('LogEntry');
|
|
|
|
if (index > 0) {
|
|
|
|
name = name.substr(0, index);
|
|
|
|
}
|
|
|
|
return `${name}(${this._type})`;
|
2020-12-07 08:44:54 +00:00
|
|
|
}
|
|
|
|
|
2021-05-25 08:49:11 +00:00
|
|
|
get toolTipDict() {
|
|
|
|
const toolTipDescription = {
|
|
|
|
__proto__: null,
|
|
|
|
__this__: this,
|
|
|
|
title: this.toString()
|
|
|
|
};
|
|
|
|
for (let key of this.constructor.propertyNames) {
|
|
|
|
toolTipDescription[key] = this[key];
|
|
|
|
}
|
|
|
|
|
|
|
|
return toolTipDescription;
|
2020-12-07 08:44:54 +00:00
|
|
|
}
|
|
|
|
|
2020-10-19 10:13:33 +00:00
|
|
|
// Returns an Array of all possible #type values.
|
|
|
|
static get allTypes() {
|
2020-11-03 08:01:33 +00:00
|
|
|
throw new Error('Not implemented.');
|
2020-10-19 10:13:33 +00:00
|
|
|
}
|
2021-05-25 08:49:11 +00:00
|
|
|
|
|
|
|
// Returns an array of public property names.
|
|
|
|
static get propertyNames() {
|
|
|
|
throw new Error('Not implemented.');
|
|
|
|
}
|
2020-12-07 08:44:54 +00:00
|
|
|
}
|