UNPKG

@eth-optimism/ethereumjs-vm

Version:
49 lines 1.6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Logger = void 0; var debug_1 = require("debug"); var uuid_1 = require("uuid"); var Logger = /** @class */ (function () { function Logger(namespace) { this._namespace = namespace; this._debugger = debug_1.default(namespace); } Logger.prototype.log = function (message) { this._debugger(message); }; Logger.prototype.scope = function (namespace, id) { return new Logger(this._namespace + ":" + namespace + ":" + (id || uuid_1.v4())); }; Object.defineProperty(Logger.prototype, "enabled", { get: function () { return this._debugger.enabled; }, enumerable: false, configurable: true }); Object.defineProperty(Logger.prototype, "namespace", { get: function () { return this._namespace; }, enumerable: false, configurable: true }); Logger.prototype.logSection = function (message) { this.log("------" + '-'.repeat(message.length) + "------"); this.log("----- " + message + " -----"); this.log("------" + '-'.repeat(message.length) + "------"); }; Logger.prototype.open = function (message) { this._section = message; this.logSection("BEGIN: " + this._section); }; Logger.prototype.close = function () { if (!this._section) { return; } this.logSection("END : " + this._section); }; return Logger; }()); exports.Logger = Logger; //# sourceMappingURL=logger.js.map