[PATCH 1/8] Move logging functions to a new file, log.c