Add logging module

Route all logging functions through this module. Support both logging to files and syslog.

Related: #37.

Fixes #40.