Implement logging facility

Logging can be enabled by passing a file path to the "-l" command-line
option, or using the "logpath=PATH" config file option.  By default,
only certain exceptional events are logged.  If debug mode
("-d" option in command line) is enabled, information useful for
debugging will also be logged, at the cost of greatly increasing the log
file's size.

Currently, only the daemon processes write to the log file.  This may
change in the future.
Update doc to include logging
Sync version tag 1.0.5