Add a wrapper lib for common functions

Certain functions such as malloc/realloc/asprintf need special handling for
their errors, often erroring out or providing the same error message, etc.

This therefore introduces such a wrapper.  Not used too much at the moment.
Introduce logging API

So that we can have consistent logging, provide an interface to opening a
log file, saving lines to it, etc.  The caller will mostly want log_msg()
and log_fatal() for now.

Not a lot uses this, but will be useful for debugging.
Add logging/wrapper to Makefile
main:  Initialise log_level to 0

This will be dynamically set once command-line flags are parsed.