Support --logfile argument to make all output go to a file.

This works for both client and server side (in the case of the server,
either for daemon or non-daemon mode).

Consistifies a few places that were using printf instead of iprintf.

Fixes Issue 119.