Better logging

Similar comment about handling stdout as a big buffer instead of line-by-line.