Logging rework
Refactor logging.
Loglevel enum changed to match syslog levels. Provide API to set callback OR file pointer and or udp address for logging. Default to stderr.
ifdef the vasprintf and asprintf functions in stdio-shim, they are provided on (most) unixes: better to use the provided ones in those cases.
Edited by Gijs Peskens