Added logging function for errors and other info.