UNPKG

react-ts5-remote-app-api

Version:

React hook/api for the TeamSpeak5 remote app feature

52 lines (51 loc) 2.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var Logger = /** @class */ (function () { function Logger(enabled) { this.enabled = enabled; } // Log message to the console Logger.prototype.log = function (message, data) { if (data === void 0) { data = null; } if (!this.enabled) return; console.log("[Log] %c".concat(message).trim(), "color: gray", data !== null && data !== void 0 ? data : ""); }; // Log warning to the console Logger.prototype.warn = function (message, data) { if (data === void 0) { data = null; } if (!this.enabled) return; console.warn("%c".concat(message).trim(), data !== null && data !== void 0 ? data : ""); }; // Log error to the console Logger.prototype.error = function (message, data) { if (data === void 0) { data = null; } if (!this.enabled) return; console.error("%c".concat(message).trim(), data !== null && data !== void 0 ? data : ""); }; // Log message received from the websocket to the console Logger.prototype.wsReceived = function (data, message) { if (message === void 0) { message = undefined; } if (!this.enabled) return; console.log("%c[WS Recieved] ".concat(message !== null && message !== void 0 ? message : "").trim(), "color: #8258c7", data); }; // Log message sent to the websocket to the console Logger.prototype.wsSent = function (data, message) { if (message === void 0) { message = undefined; } if (!this.enabled) return; console.log("%c[WS Sent] ".concat(message !== null && message !== void 0 ? message : "").trim(), "color: #4eb570", data); }; // Log message to the console with a timestamp Logger.prototype.ts = function (message, data) { if (data === void 0) { data = null; } if (!this.enabled) return; console.log("%c[TS] ".concat(message).trim(), "color: #2e6bc7", data !== null && data !== void 0 ? data : ""); }; return Logger; }()); exports.default = Logger;