Added a write Log function to make an error log entry