cobinhood-rx
Version:
CobinhoodRx is a rxjs node wrapper for the CobinhoodRx Api.
28 lines • 993 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const Enum_1 = require("../Enum");
class Logger {
constructor(logType = 3, logWriter) {
this.logType = logType;
this.logWriter = (logWriter !== null) ? logWriter : console.log;
}
static create(logType = Enum_1.LogTypeValue.None, logWriter) {
this.instance = new Logger(logType, logWriter);
}
static get Stream() {
if (!this.instance) {
this.create(Enum_1.LogTypeValue.Error, console.log);
}
return this.instance;
}
write(logType, message) {
const output = `${Enum_1.LogTypeValue[logType].toString()} : ${message}`;
if (this.logType !== Enum_1.LogTypeValue.None) {
if (logType === this.logType || this.logType === Enum_1.LogTypeValue.Debug) {
this.logWriter(output);
}
}
}
}
exports.Logger = Logger;
//# sourceMappingURL=Logger.js.map