Writes error logs