Write log file one line at a time

This fixes bug #1137
I assume you mean `line` instead of `text`.