Switch stdout to line buffering if -printtoconsole is given

Use line buffering (instead of block buffering) when logging to stdout,
so that messages arrive immediately in systemd-journald and the like.