Added logging function.