Fix issue with logs read from stdin. Thanks to hubert depesz lubaczewski for the report.