logs: escape and unescape new lines
This commit is contained in:
@@ -59,7 +59,8 @@ async function start() {
|
||||
|
||||
try {
|
||||
fs.mkdirSync(appLogDir, { recursive: true });
|
||||
fs.appendFileSync(`${appLogDir}/app.log`, `${info.timestamp} ${info.message.trim()}\n`);
|
||||
const escaped = info.message.trim().replace(/\\/g, '\\\\').replace(/\n/g, '\\n');
|
||||
fs.appendFileSync(`${appLogDir}/app.log`, `${info.timestamp} ${escaped}\n`);
|
||||
} catch (error) {
|
||||
log(error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user