Compare commits

...

3 Commits

Author SHA1 Message Date
Johannes Zellner
2da0ae6dc0 Bump version 2018-06-14 13:21:26 +02:00
Johannes Zellner
bdb9ae36ce Ensure we add a newline to every log message 2018-06-14 13:19:44 +02:00
Johannes Zellner
3357b14ef1 Remove potential line breaks from log lines 2018-06-14 12:10:33 +02:00
3 changed files with 7 additions and 3 deletions

View File

@@ -44,12 +44,16 @@ server.on('error', function (error) {
if (!info || !info.appName) return console.log('Ignore unknown app log:', msg.toString());
// remove line breaks to avoid holes in the log file
// we do not ignore empty log lines, to allow gaps for potential ease of readability
const message = info.message.replace(/\n/g, '');
const filePath = path.join(LOG_FILE_FOLDER, info.appName);
const fileName = path.join(filePath, LOG_FILE_NAME);
try {
mkdirp.sync(filePath);
fs.appendFileSync(fileName, info.ts.toISOString() + ' ' + info.message);
fs.appendFileSync(fileName, info.ts.toISOString() + ' ' + message + '\n');
} catch (error) {
console.error(error);
}

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "cloudron-syslog",
"version": "1.0.1",
"version": "1.0.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "cloudron-syslog",
"version": "1.0.1",
"version": "1.0.2",
"description": "Cloudron Syslog Daemon listening on port 2514",
"main": "index.js",
"scripts": {