[mirotalksfu] - add util
هذا الالتزام موجود في:
@@ -1,5 +1,12 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const util = require('util');
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
depth: null,
|
||||||
|
colors: true,
|
||||||
|
};
|
||||||
|
|
||||||
const Log = {
|
const Log = {
|
||||||
// action
|
// action
|
||||||
ac: {
|
ac: {
|
||||||
@@ -50,25 +57,29 @@ module.exports = class Logger {
|
|||||||
if (this.debugOn) {
|
if (this.debugOn) {
|
||||||
this.timeEnd = performance.now();
|
this.timeEnd = performance.now();
|
||||||
this.timeElapsedMs = this.getFormatTime(Math.floor(this.timeEnd - this.timeStart));
|
this.timeElapsedMs = this.getFormatTime(Math.floor(this.timeEnd - this.timeStart));
|
||||||
console.debug('[' + this.getDataTime() + '] [' + this.appName + '] ' + msg, op, this.timeElapsedMs);
|
console.debug(
|
||||||
|
'[' + this.getDataTime() + '] [' + this.appName + '] ' + msg,
|
||||||
|
util.inspect(op, options),
|
||||||
|
this.timeElapsedMs,
|
||||||
|
);
|
||||||
this.timeStart = performance.now();
|
this.timeStart = performance.now();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log(msg, op = '') {
|
log(msg, op = '') {
|
||||||
console.log('[' + this.getDataTime() + '] [' + this.appName + '] ' + msg, op);
|
console.log('[' + this.getDataTime() + '] [' + this.appName + '] ' + msg, util.inspect(op, options));
|
||||||
}
|
}
|
||||||
|
|
||||||
info(msg, op = '') {
|
info(msg, op = '') {
|
||||||
console.info('[' + this.getDataTime() + '] [' + this.appName + '] ' + msg, op);
|
console.info('[' + this.getDataTime() + '] [' + this.appName + '] ' + msg, util.inspect(op, options));
|
||||||
}
|
}
|
||||||
|
|
||||||
warn(msg, op = '') {
|
warn(msg, op = '') {
|
||||||
console.warn('[' + this.getDataTime() + '] [' + this.appName + '] ' + msg, op);
|
console.warn('[' + this.getDataTime() + '] [' + this.appName + '] ' + msg, util.inspect(op, options));
|
||||||
}
|
}
|
||||||
|
|
||||||
error(msg, op = '') {
|
error(msg, op = '') {
|
||||||
console.error('[' + this.getDataTime() + '] [' + this.appName + '] ' + msg, op);
|
console.error('[' + this.getDataTime() + '] [' + this.appName + '] ' + msg, util.inspect(op, options));
|
||||||
}
|
}
|
||||||
|
|
||||||
getDataTime() {
|
getDataTime() {
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم