1 | "use strict";
|
---|
2 | var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
---|
3 | for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
---|
4 | to[j] = from[i];
|
---|
5 | return to;
|
---|
6 | };
|
---|
7 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
8 | exports.Logger = void 0;
|
---|
9 | var Logger = /** @class */ (function () {
|
---|
10 | function Logger(_a) {
|
---|
11 | var id = _a.id, enabled = _a.enabled;
|
---|
12 | this.id = id;
|
---|
13 | this.enabled = enabled;
|
---|
14 | this.start = Date.now();
|
---|
15 | }
|
---|
16 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
---|
17 | Logger.prototype.debug = function () {
|
---|
18 | var args = [];
|
---|
19 | for (var _i = 0; _i < arguments.length; _i++) {
|
---|
20 | args[_i] = arguments[_i];
|
---|
21 | }
|
---|
22 | if (this.enabled) {
|
---|
23 | // eslint-disable-next-line no-console
|
---|
24 | if (typeof window !== 'undefined' && window.console && typeof console.debug === 'function') {
|
---|
25 | // eslint-disable-next-line no-console
|
---|
26 | console.debug.apply(console, __spreadArray([this.id, this.getTime() + "ms"], args));
|
---|
27 | }
|
---|
28 | else {
|
---|
29 | this.info.apply(this, args);
|
---|
30 | }
|
---|
31 | }
|
---|
32 | };
|
---|
33 | Logger.prototype.getTime = function () {
|
---|
34 | return Date.now() - this.start;
|
---|
35 | };
|
---|
36 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
---|
37 | Logger.prototype.info = function () {
|
---|
38 | var args = [];
|
---|
39 | for (var _i = 0; _i < arguments.length; _i++) {
|
---|
40 | args[_i] = arguments[_i];
|
---|
41 | }
|
---|
42 | if (this.enabled) {
|
---|
43 | // eslint-disable-next-line no-console
|
---|
44 | if (typeof window !== 'undefined' && window.console && typeof console.info === 'function') {
|
---|
45 | // eslint-disable-next-line no-console
|
---|
46 | console.info.apply(console, __spreadArray([this.id, this.getTime() + "ms"], args));
|
---|
47 | }
|
---|
48 | }
|
---|
49 | };
|
---|
50 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
---|
51 | Logger.prototype.warn = function () {
|
---|
52 | var args = [];
|
---|
53 | for (var _i = 0; _i < arguments.length; _i++) {
|
---|
54 | args[_i] = arguments[_i];
|
---|
55 | }
|
---|
56 | if (this.enabled) {
|
---|
57 | // eslint-disable-next-line no-console
|
---|
58 | if (typeof window !== 'undefined' && window.console && typeof console.warn === 'function') {
|
---|
59 | // eslint-disable-next-line no-console
|
---|
60 | console.warn.apply(console, __spreadArray([this.id, this.getTime() + "ms"], args));
|
---|
61 | }
|
---|
62 | else {
|
---|
63 | this.info.apply(this, args);
|
---|
64 | }
|
---|
65 | }
|
---|
66 | };
|
---|
67 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
---|
68 | Logger.prototype.error = function () {
|
---|
69 | var args = [];
|
---|
70 | for (var _i = 0; _i < arguments.length; _i++) {
|
---|
71 | args[_i] = arguments[_i];
|
---|
72 | }
|
---|
73 | if (this.enabled) {
|
---|
74 | // eslint-disable-next-line no-console
|
---|
75 | if (typeof window !== 'undefined' && window.console && typeof console.error === 'function') {
|
---|
76 | // eslint-disable-next-line no-console
|
---|
77 | console.error.apply(console, __spreadArray([this.id, this.getTime() + "ms"], args));
|
---|
78 | }
|
---|
79 | else {
|
---|
80 | this.info.apply(this, args);
|
---|
81 | }
|
---|
82 | }
|
---|
83 | };
|
---|
84 | Logger.instances = {};
|
---|
85 | return Logger;
|
---|
86 | }());
|
---|
87 | exports.Logger = Logger;
|
---|
88 | //# sourceMappingURL=logger.js.map |
---|