Skip to content

Commit

Permalink
[ORCT-184] replace info logs by debug (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
xsalonx authored Oct 24, 2023
1 parent 5ff4bd6 commit 26eebd8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 24 deletions.
16 changes: 4 additions & 12 deletions app/lib/alimonitor-services/AbstractServiceSynchronizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,6 @@ class AbstractServiceSynchronizer {
true,
);

const { logsStacker } = pfxWrp;
logsStacker.logType('info');
if (!pfxWrp.content) {
if (logsStacker.any('error')) {
logsStacker.logType('warn');
logsStacker.logType('error');
}
}
const passphrase = ResProvider.passphraseProvider();

opts.pfx = pfxWrp.content;
Expand All @@ -94,10 +86,10 @@ class AbstractServiceSynchronizer {
setHttpSocksProxy(opts) {
const proxy = ResProvider.socksProvider();
if (proxy?.length > 0) {
this.logger.info(`using proxy/socks '${proxy}' to CERN network`);
this.logger.debug(`using proxy/socks '${proxy}' to CERN network`);
opts.agent = new SocksProxyAgent(proxy);
} else {
this.logger.info('service do not use proxy/socks to reach CERN network');
this.logger.debug('service do not use proxy/socks to reach CERN network');
}
return opts;
}
Expand Down Expand Up @@ -177,7 +169,7 @@ class AbstractServiceSynchronizer {

async getRawResponse(endpoint) {
if (this.useCacheJsonInsteadIfPresent && Cacher.isCached(this.name, endpoint) || this.forceToUseOnlyCache) {
this.logger.info(`using cached json :: ${Cacher.cachedFilePath(this.name, endpoint)}`);
this.logger.debug(`using cached json :: ${Cacher.cachedFilePath(this.name, endpoint)}`);
return Cacher.getJsonSync(this.name, endpoint);
}
const onSucces = (endpoint, data) => {
Expand All @@ -198,7 +190,7 @@ class AbstractServiceSynchronizer {
* Minor errors are understood as e.g. managable ambiguities in data.
*/
async setSyncTask(options) {
this.progressMonitor = new ProgressMonitor({ logger: this.logger.info.bind(this.logger), percentageStep: 0.25 });
this.progressMonitor = new ProgressMonitor({ logger: this.logger.debug.bind(this.logger), percentageStep: 0.25 });
this.forceStop = false;
return await this.sync(options)
.catch((fatalError) => {
Expand Down
2 changes: 1 addition & 1 deletion app/lib/alimonitor-services/BookkeepingService.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class BookkeepingService extends AbstractServiceSynchronizer {
this.metaDataHandler.bind(this),
);
results.push(partialResult);
this.logger.info(`processed ${state['page']} pages of ${this.metaStore['pageCount']}`);
this.logger.debug(`processed ${state['page']} pages of ${this.metaStore['pageCount']}`);
state = this.nextState(state);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class PassCorrectnessMonitor {
logger.warn(`sync unseccessful for ${incorrect}/${dataSize}`);
}
if (omitted > 0) {
logger.info(`omitted data units ${omitted}/${dataSize}`);
logger.debug(`omitted data units ${omitted}/${dataSize}`);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/lib/database/DatabaseService.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class DatabaseService {

async healthcheckInsertData() {
for (const def of Object.values(config.rctData.healthcheckQueries.checkStaticData)) {
this.logger.info(`healthcheck : ${def.description}`);
this.logger.debug(`healthcheck : ${def.description}`);
for (const q of def.query) {
const logger = config.rctData.suppressHealthcheckLogs ? () => null : (e) => this.logger.error(e.stack);
await this.pgExec(q, logger, null, logger);
Expand Down
16 changes: 7 additions & 9 deletions app/lib/utils/ResProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,24 +137,22 @@ class ResProvider {
}
if (!secContent) {
logsStacker.put(
'error',
'warn',
`${description}: cannot load file from provided files: [${fileNames.join(',')}] nor from env var ${envVarName}`,
);
}

if (!supressLogs) {
logsStacker.typeLog('info');
if (logsStacker.any('error')) {
logsStacker.typeLog('warn');
logsStacker.typeLog('error');
}
logsStacker.logType('info');
logsStacker.logType('warn');
logsStacker.logType('error');
}
return { content: secContent, logsStacker: logsStacker };
}

static socksProvider() {
const cern_socks_env_var = process.env.CERN_SOCKS;
logger.info(`CERN_SOCKS set to '${cern_socks_env_var}'`);
logger.debug(`CERN_SOCKS set to '${cern_socks_env_var}'`);
if (process.env.RUNNING_ENV == 'DOCKER' && cern_socks_env_var?.toLowerCase() === 'true') {
return 'socks://172.200.200.1:12345';
}
Expand Down Expand Up @@ -233,9 +231,9 @@ class ResProvider {

static passphraseProvider() {
if (process.env.ALIMONITOR_PASSPHRASE) {
logger.info('using passphrase');
logger.debug('using passphrase');
} else {
logger.info('no passphrase');
logger.debug('no passphrase');
}
return process.env.ALIMONITOR_PASSPHRASE;
}
Expand Down

0 comments on commit 26eebd8

Please sign in to comment.