Add error logging functionality