88 lines
3.3 KiB
JavaScript
88 lines
3.3 KiB
JavaScript
"use strict";
|
|
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
to[j] = from[i];
|
|
return to;
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.Logger = void 0;
|
|
var Logger = /** @class */ (function () {
|
|
function Logger(_a) {
|
|
var id = _a.id, enabled = _a.enabled;
|
|
this.id = id;
|
|
this.enabled = enabled;
|
|
this.start = Date.now();
|
|
}
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
Logger.prototype.debug = function () {
|
|
var args = [];
|
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
args[_i] = arguments[_i];
|
|
}
|
|
if (this.enabled) {
|
|
// eslint-disable-next-line no-console
|
|
if (typeof window !== 'undefined' && window.console && typeof console.debug === 'function') {
|
|
// eslint-disable-next-line no-console
|
|
console.debug.apply(console, __spreadArray([this.id, this.getTime() + "ms"], args));
|
|
}
|
|
else {
|
|
this.info.apply(this, args);
|
|
}
|
|
}
|
|
};
|
|
Logger.prototype.getTime = function () {
|
|
return Date.now() - this.start;
|
|
};
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
Logger.prototype.info = function () {
|
|
var args = [];
|
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
args[_i] = arguments[_i];
|
|
}
|
|
if (this.enabled) {
|
|
// eslint-disable-next-line no-console
|
|
if (typeof window !== 'undefined' && window.console && typeof console.info === 'function') {
|
|
// eslint-disable-next-line no-console
|
|
console.info.apply(console, __spreadArray([this.id, this.getTime() + "ms"], args));
|
|
}
|
|
}
|
|
};
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
Logger.prototype.warn = function () {
|
|
var args = [];
|
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
args[_i] = arguments[_i];
|
|
}
|
|
if (this.enabled) {
|
|
// eslint-disable-next-line no-console
|
|
if (typeof window !== 'undefined' && window.console && typeof console.warn === 'function') {
|
|
// eslint-disable-next-line no-console
|
|
console.warn.apply(console, __spreadArray([this.id, this.getTime() + "ms"], args));
|
|
}
|
|
else {
|
|
this.info.apply(this, args);
|
|
}
|
|
}
|
|
};
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
Logger.prototype.error = function () {
|
|
var args = [];
|
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
args[_i] = arguments[_i];
|
|
}
|
|
if (this.enabled) {
|
|
// eslint-disable-next-line no-console
|
|
if (typeof window !== 'undefined' && window.console && typeof console.error === 'function') {
|
|
// eslint-disable-next-line no-console
|
|
console.error.apply(console, __spreadArray([this.id, this.getTime() + "ms"], args));
|
|
}
|
|
else {
|
|
this.info.apply(this, args);
|
|
}
|
|
}
|
|
};
|
|
Logger.instances = {};
|
|
return Logger;
|
|
}());
|
|
exports.Logger = Logger;
|
|
//# sourceMappingURL=logger.js.map
|