[mirotalksfu] - refactoring

هذا الالتزام موجود في:
Miroslav Pejic
2021-10-07 22:48:32 +02:00
الأصل b62a89bfa7
التزام 976ac95fc5
26 ملفات معدلة مع 59 إضافات و61 حذوفات

25
app/src/Logger.js Normal file
عرض الملف

@@ -0,0 +1,25 @@
'use strict';
module.exports = class Logger {
constructor(appName, debugOn = true) {
if (appName) this.appName = appName;
else this.appName = 'mirotalk';
this.debugOn = debugOn;
}
debug(msg, op = '') {
if (this.debugOn === false) return;
let dataTime = new Date().toISOString().replace(/T/, ' ').replace(/Z/, '');
console.log('[' + dataTime + '] [' + this.appName + '] ' + msg, op);
}
warn(msg, op = '') {
let dataTime = new Date().toISOString().replace(/T/, ' ').replace(/Z/, '');
console.warn('[' + dataTime + '] [' + this.appName + '] ' + msg, op);
}
error(msg, op = '') {
let dataTime = new Date().toISOString().replace(/T/, ' ').replace(/Z/, '');
console.error('[' + dataTime + '] [' + this.appName + '] ' + msg, op);
}
};