WIP: 6533 myLogger_salix #2
|
@ -20,6 +20,11 @@ module.exports = class ModelLoader {
|
||||||
schemaMap,
|
schemaMap,
|
||||||
logMap
|
logMap
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(!conf.logs ) conf.logs = {}
|
||||||
|
Object.keys(conf.logs??{}).length > 0 && console.warn('‼️ - Existen modelos NO exportados')
|
||||||
|
Object.assign(conf.logs, logs)
|
||||||
|
|
||||||
|
|
||||||
for (const logName in conf.logs) {
|
for (const logName in conf.logs) {
|
||||||
const logConf = conf.logs[logName];
|
const logConf = conf.logs[logName];
|
||||||
|
|
32
lib/salix.js
32
lib/salix.js
|
@ -12,34 +12,38 @@ module.exports = class Salix {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetch(path) {
|
async fetch(path) {
|
||||||
let salixCall = await fetch(`${this.conf.salix.url}/${path}`, {
|
try {
|
||||||
method: "GET",
|
let salixCall = await fetch(`${this.conf.salix.url}/${path}`, {
|
||||||
});
|
method: "GET",
|
||||||
const response = JSON.parse(await salixCall.text());
|
});
|
||||||
if (salixCall.status !== 200) {
|
const response = JSON.parse(await salixCall.text());
|
||||||
console.error(response.error);
|
if (salixCall.status !== 200) {
|
||||||
throw new Error(response.error.message);
|
console.error(response.error);
|
||||||
|
throw new Error(response.error.message);
|
||||||
|
}
|
||||||
|
this._salixVersion = salixCall.headers.get("Salix-version");
|
||||||
|
return response;
|
||||||
|
} catch (error) {
|
||||||
|
throw new Error(error.message);
|
||||||
}
|
}
|
||||||
this._salixVersion = salixCall.headers.get("Salix-version");
|
|
||||||
return response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getSalixVersion() {
|
async getSalixVersion() {
|
||||||
log("CHECK VERSION");
|
this.log("CHECK VERSION");
|
||||||
|
|
||||||
const salixVersion = await this.fetch("applications/version");
|
const salixVersion = await this.fetch("applications/version");
|
||||||
if (this._salixVersion !== salixVersion) fetch();
|
if (this._salixVersion !== salixVersion) fetch();
|
||||||
|
|
||||||
log("VERSION CHECKED");
|
this.log("VERSION CHECKED");
|
||||||
}
|
}
|
||||||
|
|
||||||
async salixLogInfo() {
|
async salixLogInfo() {
|
||||||
log("LOGINFO REQUEST");
|
this.log("LOGINFO REQUEST");
|
||||||
let salixLogConfig = await this.fetch("schemas/logInfo");
|
let salixLogConfig = await this.fetch("schemas/logInfo");
|
||||||
|
|
||||||
this._logInfo = [salixLogConfig];
|
this._logInfo = salixLogConfig;
|
||||||
|
|
||||||
log("LOGINFO REQUESTED");
|
this.log("LOGINFO REQUESTED");
|
||||||
}
|
}
|
||||||
|
|
||||||
log(param) {
|
log(param) {
|
||||||
|
|
Loading…
Reference in New Issue