Add logging support

* Code-selectable logging to either stdout or syslog
* Coloured log levels when on stdout
* Convenience macros to reduce typing for common checks