1// Copyright 2020 the V8 project authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5export class LogEntry { 6 constructor(type, time) { 7 this._time = time; 8 this._type = type; 9 this.sourcePosition = undefined; 10 } 11 12 get time() { 13 return this._time; 14 } 15 16 get type() { 17 return this._type; 18 } 19 20 get script() { 21 return this.sourcePosition?.script; 22 } 23 24 toString() { 25 let name = this.constructor.name; 26 const index = name.lastIndexOf('LogEntry'); 27 if (index > 0) { 28 name = name.substr(0, index); 29 } 30 return `${name}(${this._type})`; 31 } 32 33 get toolTipDict() { 34 const toolTipDescription = { 35 __proto__: null, 36 __this__: this, 37 title: this.toString() 38 }; 39 for (let key of this.constructor.propertyNames) { 40 toolTipDescription[key] = this[key]; 41 } 42 43 return toolTipDescription; 44 } 45 46 // Returns an Array of all possible #type values. 47 static get allTypes() { 48 throw new Error('Not implemented.'); 49 } 50 51 // Returns an array of public property names. 52 static get propertyNames() { 53 throw new Error('Not implemented.'); 54 } 55}