awaitqueue
Version:
TypeScript utility to enqueue asynchronous tasks and run them sequentially one after another
38 lines (37 loc) • 1.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Logger = void 0;
const debug = require("debug");
const LIB_NAME = 'awaitqueue';
class Logger {
_debug;
_warn;
_error;
constructor(prefix) {
if (prefix) {
this._debug = debug(`${LIB_NAME}:${prefix}`);
this._warn = debug(`${LIB_NAME}:WARN:${prefix}`);
this._error = debug(`${LIB_NAME}:ERROR:${prefix}`);
}
else {
this._debug = debug(LIB_NAME);
this._warn = debug(`${LIB_NAME}:WARN`);
this._error = debug(`${LIB_NAME}:ERROR`);
}
/* eslint-disable no-console */
this._debug.log = console.info.bind(console);
this._warn.log = console.warn.bind(console);
this._error.log = console.error.bind(console);
/* eslint-enable no-console */
}
get debug() {
return this._debug;
}
get warn() {
return this._warn;
}
get error() {
return this._error;
}
}
exports.Logger = Logger;