Created error logging mechanism