// logger.js

exports.addLogging = addLogging
function addLogging(child, slogan) {
	addListener(child.stdout)
	addListener(child.stderr)

	function addListener(io) {
		if (io) {
			io.on('data', log).on('end', cleanUp)
			io.setEncoding('utf-8')
		}

		function cleanUp() {
			io.removeListener('data', log)
			io.removeListener('end', cleanUp)
		}
	}

	function log(str) {
		str.split('\n').forEach(function (line) {
			console.log(slogan, line)
		})
	}
}
@@ -342,20 +342,43 @@
 Up)%0A%09%09%7D%0A
-%09%7D%0A%0A
+%0A%09%09var atEndOfLine = true%0A%09
 %09functio
@@ -394,86 +394,401 @@
 ) %7B%0A
+%0A
 %09%09
-str.split('%5Cn').forEach(function (line) %7B%0A%09%09%09console.log(slogan, line)%0A%09%09%7D)
+%09// beginning of each line needs an app marker%0A%09%09%09var arr = str.split('%5Cn')%0A%09%09%09var lastIndex = arr.length - 1%0A%09%09%09for (var index = 0; index %3C lastIndex; index++) %7B%0A%09%09%09%09if (index != 0 %7C%7C atEndOfLine) process.stdout.write(slogan + ' ')%0A%09%09%09%09process.stdout.write(arr%5Bindex%5D + '%5Cn')%0A%09%09%09%7D%0A%09%09%09if (arr%5BlastIndex%5D.length) %7B%0A%09%09%09%09atEndOfLine = false%0A%09%09%09%09process.stdout.write(arr%5BlastIndex%5D)%0A%09%09%09%7D%0A%09%09%7D%0A
 %0A%09%7D%0A
+%0A
 %7D

fix insertion of appmarker