Added a function for warnings and added 'log' as an option for errors