Still gotta fix typings, temporary fix

This commit is contained in:
Wessel Tip
2019-08-16 17:45:31 +02:00
parent 8edece3637
commit ccc9f191d9
2 changed files with 22 additions and 57 deletions

View File

@@ -6,7 +6,7 @@ const PikminError = require('./PikminError');
module.exports = class PikminInstance {
/**
* Create a pikmin instance
*
*
* @param {object} options The options for the instance
* @param {string} [options.name='main'] The logger's name
* @param {string} [options.format='[%h:%m:%s] %l ->'] The logger's format
@@ -42,7 +42,7 @@ module.exports = class PikminInstance {
if (transport.name) {
this[transport.name] = (msg, options) => this._print(msg, Object.assign(transport.defaults, options), transport.name, transport.format || this.baseFormat);
this.__log__[transport.name] = (msg, options) => this._print(msg, Object.assign(transport.defaults, options), transport.name, transport.format || this.baseFormat);
} else transport.permanent = true;
} else transport.permanent = true;
} catch(ex) {
throw new PikminError(`Failed to write to transporter:\r\n${ex}`);
}
@@ -59,19 +59,19 @@ module.exports = class PikminInstance {
if (type(transport) !== 2) throw new TypeError(`"transports" must be type of object but received type ${typeof transport}`);
if (transport.name && this[transport.name]) throw new PikminError(`A transporter\'s name inflicted with an already existing declaration`);
try {
if (transport.type === 'FILE' && options.autogen) transport.append(`<PIKMIN_AUTOGEN_LINE<${now.days}/${now.months}/${now.years} ${now.hours}:${now.minutes}:${now.seconds}>>\r\n`);
this.transports.push(transport);
if (transport.name) {
this[transport.name] = (msg, opt) => this._print(msg, Object.assign(transport.defaults, opt), transport.name, transport.format || this.baseFormat,);
this.__log__[transport.name] = (msg, opt) => this._print(msg, Object.assign(transport.defaults, opt), transport.name, transport.format || this.baseFormat);
} else transport.permanent = true;
} else transport.permanent = true;
} catch(ex) {
throw new PikminError(`Failed to write to transporter:\r\n${ex}`);
}
Pikmin.loggers.set(this.name, this.__log__);
}