@perceptr/web-sdk
Version:
Perceptr Web SDK for recording and monitoring user sessions
37 lines (36 loc) • 870 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.logger = void 0;
class Logger {
constructor() {
this.isDebugEnabled = false;
}
static getInstance() {
if (!Logger.instance) {
Logger.instance = new Logger();
}
return Logger.instance;
}
configure(config) {
this.isDebugEnabled = !!config.debug;
}
debug(...args) {
if (this.isDebugEnabled) {
console.debug("[SDK] ", ...args);
}
}
warn(...args) {
if (this.isDebugEnabled) {
console.warn("[SDK] ", ...args);
}
}
error(...args) {
if (this.isDebugEnabled) {
console.error("[SDK] ", ...args);
}
}
forceLog(level, ...args) {
console[level](...args);
}
}
exports.logger = Logger.getInstance();