Skip to content

Commit 4f6b66b

Browse files
committed
notifier-server: fix logging of subsequent parameters
1 parent d817245 commit 4f6b66b

1 file changed

Lines changed: 6 additions & 15 deletions

File tree

notifier-server.js

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,6 @@ function makeLogger (logFn, namespace) {
2020
}
2121

2222
function makeExec (directory, filename, log) {
23-
function doLog (prefix, text) {
24-
const parts = ('' + text).split(/\n/);
25-
for (const line of parts) {
26-
if (line.length) {
27-
log(prefix, line);
28-
}
29-
}
30-
}
31-
3223
// Use an async queue so that if we receive multiple events for the same repo,
3324
// we let the corresponding shell scripts run serially. Scripts may assume that:
3425
// - Their project directory will not be operated on by other instances of self.
@@ -39,17 +30,17 @@ function makeExec (directory, filename, log) {
3930
let queue = Promise.resolve();
4031
function spawn (eventData, callback) {
4132
const commit = eventData.commit;
42-
log('spawn', commit);
33+
log('spawn ' + commit);
4334

4435
const proc = cp.spawn(path.join(directory, filename), [commit]);
4536
proc.stdout.on('data', function (data) {
46-
doLog('out', data);
37+
log('out ' + data);
4738
});
4839
proc.stderr.on('data', function (data) {
49-
doLog('err', data);
40+
log('err ' + data);
5041
});
5142
proc.on('exit', function (code) {
52-
log('exit', code);
43+
log('exit ' + code);
5344
});
5445
proc.on('close', function () {
5546
// Ignore errors
@@ -60,11 +51,11 @@ function makeExec (directory, filename, log) {
6051

6152
return function (data) {
6253
if (invalidSHA.test(data.commit)) {
63-
log('Invalid commit SHA1', data);
54+
log('Invalid commit SHA1 ' + data);
6455
return;
6556
}
6657

67-
log('queue', data.commit);
58+
log('queue ' + data.commit);
6859
queue = queue.then(function () {
6960
return new Promise(function (resolve) {
7061
spawn(data, resolve);

0 commit comments

Comments
 (0)