1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 02:09:32 +02:00

Refactor stream log output to a utility.

This commit is contained in:
Simo Kinnunen 2014-04-01 21:55:50 +09:00
parent d6604bcda8
commit e43507b686
6 changed files with 26 additions and 23 deletions

View file

@ -43,7 +43,6 @@ module.exports.readAll = function(stream) {
})
}
module.exports.findLine = function(stream, re) {
var resolver = Promise.defer()
, piped = stream.pipe(split())
@ -73,3 +72,13 @@ module.exports.findLine = function(stream, re) {
stream.unpipe(piped)
})
}
module.exports.talk = function(log, format, stream) {
stream.pipe(split())
.on('data', function(chunk) {
var line = chunk.toString().trim()
if (line.length) {
log.info(format, line)
}
})
}