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:
parent
d6604bcda8
commit
e43507b686
6 changed files with 26 additions and 23 deletions
|
@ -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)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue