Put healthcheck errors in app logs

This commit is contained in:
Johannes Zellner
2022-06-09 14:56:40 +02:00
parent 11d7dfa071
commit fbc7fcf04b
2 changed files with 14 additions and 0 deletions

View File

@@ -61,6 +61,8 @@ exports = module.exports = {
getLogPaths,
getLogs,
appendLogLine,
getCertificate,
start,
@@ -2013,6 +2015,16 @@ async function getLogs(app, options) {
return transformStream;
}
// never fails just prints error
async function appendLogLine(app, line) {
assert.strictEqual(typeof app, 'object');
assert.strictEqual(typeof line, 'string');
const logFilePath = path.join(paths.LOG_DIR, app.id, 'app.log');
if (!safe.fs.appendFileSync(logFilePath, line)) console.error(`Could not append log line for app ${app.id} at ${logFilePath}: ${safe.error.message}`);
}
async function getCertificate(subdomain, domain) {
assert.strictEqual(typeof subdomain, 'string');
assert.strictEqual(typeof domain, 'string');