Move logging code into new Log module