callback function for proper logging