logs: escape and unescape new lines

This commit is contained in:
Girish Ramakrishnan
2026-04-07 12:54:31 +02:00
parent 20e0774df2
commit 9e20c5a3e3
9 changed files with 25 additions and 10 deletions

View File

@@ -1377,7 +1377,8 @@ async function appendLogLine(app, line) {
const logFilePath = path.join(paths.LOG_DIR, app.id, 'app.log');
const isoDate = new Date(new Date().toUTCString()).toISOString();
if (!safe.fs.appendFileSync(logFilePath, `${isoDate} ${line}\n`)) console.error(`Could not append log line for app ${app.id} at ${logFilePath}: ${safe.error.message}`);
const escaped = line.replace(/\\/g, '\\\\').replace(/\n/g, '\\n');
if (!safe.fs.appendFileSync(logFilePath, `${isoDate} ${escaped}\n`)) console.error(`Could not append log line for app ${app.id} at ${logFilePath}: ${safe.error.message}`);
}
async function checkManifest(manifest) {