Added more logging when sending the documents to the API