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