refs #4550 Log debug mode enabled when enabled
gitea/printnatura/pipeline/head This commit looks good Details

This commit is contained in:
Juan Ferrer 2022-12-27 13:39:07 +01:00
parent d6fe231cea
commit d3ca5c2e87
1 changed files with 4 additions and 3 deletions

View File

@ -24,6 +24,8 @@ class PrintServer {
const decoration = '△▽'.repeat(10);
const printnatura = colors.bgBlack.bold(' Print'.white + 'Natura '.green);
console.log(`${decoration} ${printnatura} ${decoration}`);
if (this.conf.debug)
this.serverLog('log', 'Debug mode enabled'.yellow);
if (this.conf.dryPrint)
this.serverLog('log', 'Running in dry print mode, documents won\'t be printed'.yellow);
if (this.conf.keepFile)
@ -248,7 +250,7 @@ class PrintServer {
const resErr = new Error(`${err.message}: ${resMessage}`);
resErr.stack = err.stack;
throw resErr;
}
}
} else
throw err;
}
@ -270,7 +272,7 @@ class PrintServer {
if (!conf.dryPrint) await pExec(printCommand);
} catch(err) {
throw new Error(`Print error: ${err.message}`);
}
}
await conn.query(updateQuery, ['printed', null, jobId]);
this.jobLog(jobId, 'log', `${jobData.report}: '${printCommand}': GET ${url}`);
@ -302,7 +304,6 @@ class PrintServer {
if (index !== -1) this.jobs.splice(index, 1);
setTimeout(() => this.getJobs());
}
}
jobLog(jobId, realm, message) {
this.log(`Job[${colors.yellow(jobId)}]`, realm, message);