1. var Logger = /** @class */ (function () {
    2. function Logger(_a) {
    3. var id = _a.id, enabled = _a.enabled;
    4. this.id = id;
    5. this.enabled = enabled;
    6. this.start = Date.now();
    7. }
    8. // eslint-disable-next-line @typescript-eslint/no-explicit-any
    9. Logger.prototype.debug = function () {
    10. var args = [];
    11. for (var _i = 0; _i < arguments.length; _i++) {
    12. args[_i] = arguments[_i];
    13. }
    14. if (this.enabled) {
    15. // eslint-disable-next-line no-console
    16. if (typeof window !== 'undefined' && window.console && typeof console.debug === 'function') {
    17. // eslint-disable-next-line no-console
    18. console.debug.apply(console, [this.id, this.getTime() + "ms"].concat(args));
    19. }
    20. else {
    21. this.info.apply(this, args);
    22. }
    23. }
    24. };
    25. Logger.prototype.getTime = function () {
    26. return Date.now() - this.start;
    27. };
    28. Logger.create = function (options) {
    29. Logger.instances[options.id] = new Logger(options);
    30. };
    31. Logger.destroy = function (id) {
    32. delete Logger.instances[id];
    33. };
    34. Logger.getInstance = function (id) {
    35. var instance = Logger.instances[id];
    36. if (typeof instance === 'undefined') {
    37. throw new Error("No logger instance found with id " + id);
    38. }
    39. return instance;
    40. };
    41. // eslint-disable-next-line @typescript-eslint/no-explicit-any
    42. Logger.prototype.info = function () {
    43. var args = [];
    44. for (var _i = 0; _i < arguments.length; _i++) {
    45. args[_i] = arguments[_i];
    46. }
    47. if (this.enabled) {
    48. // eslint-disable-next-line no-console
    49. if (typeof window !== 'undefined' && window.console && typeof console.info === 'function') {
    50. // eslint-disable-next-line no-console
    51. console.info.apply(console, [this.id, this.getTime() + "ms"].concat(args));
    52. }
    53. }
    54. };
    55. // eslint-disable-next-line @typescript-eslint/no-explicit-any
    56. Logger.prototype.error = function () {
    57. var args = [];
    58. for (var _i = 0; _i < arguments.length; _i++) {
    59. args[_i] = arguments[_i];
    60. }
    61. if (this.enabled) {
    62. // eslint-disable-next-line no-console
    63. if (typeof window !== 'undefined' && window.console && typeof console.error === 'function') {
    64. // eslint-disable-next-line no-console
    65. console.error.apply(console, [this.id, this.getTime() + "ms"].concat(args));
    66. }
    67. else {
    68. this.info.apply(this, args);
    69. }
    70. }
    71. };
    72. Logger.instances = {};
    73. return Logger;
    74. }());