WIP: 6533 myLogger_salix #2

Draft
jsegarra wants to merge 11 commits from 6533_myLogger_salix into master
2 changed files with 23 additions and 14 deletions
Showing only changes of commit a376c888d9 - Show all commits

View File

@ -21,6 +21,11 @@ module.exports = class ModelLoader {
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];
const schema = logConf.schema || logger.conf.dstDb.database; const schema = logConf.schema || logger.conf.dstDb.database;

View File

@ -12,6 +12,7 @@ module.exports = class Salix {
} }
async fetch(path) { async fetch(path) {
try {
let salixCall = await fetch(`${this.conf.salix.url}/${path}`, { let salixCall = await fetch(`${this.conf.salix.url}/${path}`, {
method: "GET", method: "GET",
}); });
@ -22,24 +23,27 @@ module.exports = class Salix {
} }
this._salixVersion = salixCall.headers.get("Salix-version"); this._salixVersion = salixCall.headers.get("Salix-version");
return response; return response;
} catch (error) {
throw new Error(error.message);
}
} }
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) {