Switched print, and error messages to log messages