diff --git a/.vs/AAWeb/v15/.suo b/.vs/AAWeb/v15/.suo index ddc775432..52ee79ef6 100644 Binary files a/.vs/AAWeb/v15/.suo and b/.vs/AAWeb/v15/.suo differ diff --git a/server.js b/server.js index eb40d69aa..822b68435 100644 --- a/server.js +++ b/server.js @@ -26,16 +26,14 @@ initialize(); function initialize() { - if (CONSOLE_LOG === true) { - - console.log("I am entering the Initialize function. So far so good."); - - } + if (CONSOLE_LOG === true) { console.log("[INFO] initialize -> Entering function."); } readEcosystemConfig(); function readEcosystemConfig() { + if (CONSOLE_LOG === true) { console.log("[INFO] initialize -> readEcosystemConfig -> Entering function."); } + /* This configuration file is the backbone of the system. The first file we are going to get is a template where other configurations are @@ -93,11 +91,7 @@ function initialize() { function readCompetitionsConfig() { - if (CONSOLE_LOG === true) { - - console.log("I am entering the readCompetitionsConfig function."); - - } + if (CONSOLE_LOG === true) { console.log("[INFO] initialize -> readCompetitionsConfig -> Entering function."); } /* @@ -138,6 +132,9 @@ function initialize() { function onFileRead(err, pData) { + if (CONSOLE_LOG === true) { console.log("[INFO] initialize -> readCompetitionsConfig -> onFileRead -> Entering function."); } + if (CONSOLE_LOG === true) { console.log("[INFO] initialize -> readCompetitionsConfig -> onFileRead -> fileName = " + fileName); } + try { responsesReceived++; @@ -175,6 +172,10 @@ function initialize() { function onDataArrived(pData) { + if (CONSOLE_LOG === true) { console.log("[INFO] initialize -> readCompetitionsConfig -> onDataArrived -> Entering function."); } + if (CONSOLE_LOG === true) { console.log("[INFO] initialize -> readCompetitionsConfig -> onDataArrived -> host.codeName = " + host.codeName); } + if (CONSOLE_LOG === true) { console.log("[INFO] initialize -> readCompetitionsConfig -> onDataArrived -> competition.repo = " + competition.repo); } + try { if (CONSOLE_LOG === true) { @@ -228,6 +229,9 @@ function initialize() { function onFileRead(err, pData) { + if (CONSOLE_LOG === true) { console.log("[INFO] initialize -> readCompetitionsConfig -> onFileRead -> Entering function."); } + if (CONSOLE_LOG === true) { console.log("[INFO] initialize -> readCompetitionsConfig -> onFileRead -> fileName = " + fileName); } + try { responsesReceived++; @@ -265,6 +269,10 @@ function initialize() { function onDataArrived(pData) { + if (CONSOLE_LOG === true) { console.log("[INFO] initialize -> readCompetitionsConfig -> onDataArrived -> Entering function."); } + if (CONSOLE_LOG === true) { console.log("[INFO] initialize -> readCompetitionsConfig -> onDataArrived -> host.codeName = " + host.codeName); } + if (CONSOLE_LOG === true) { console.log("[INFO] initialize -> readCompetitionsConfig -> onDataArrived -> competition.repo = " + competition.repo); } + try { if (CONSOLE_LOG === true) { @@ -305,11 +313,8 @@ function initialize() { function readBotsAndPlottersConfig() { - if (CONSOLE_LOG === true) { + if (CONSOLE_LOG === true) { console.log("[INFO] initialize -> readBotsAndPlottersConfig -> Entering function."); } - console.log("I am entering the readBotsAndPlottersConfig function."); - - } /* Each bot has its configuration at its own repo since each team must be able to change it at will. @@ -344,6 +349,9 @@ function initialize() { function onFileRead(err, pData) { + if (CONSOLE_LOG === true) { console.log("[INFO] initialize -> readBotsAndPlottersConfig -> onFileRead -> Entering function."); } + if (CONSOLE_LOG === true) { console.log("[INFO] initialize -> readBotsAndPlottersConfig -> onFileRead -> fileName = " + fileName); } + try { responsesReceived++; @@ -381,6 +389,10 @@ function initialize() { function onDataArrived(pData) { + if (CONSOLE_LOG === true) { console.log("[INFO] initialize -> readBotsAndPlottersConfig -> onDataArrived -> Entering function."); } + if (CONSOLE_LOG === true) { console.log("[INFO] initialize -> readBotsAndPlottersConfig -> onDataArrived -> host.codeName = " + host.codeName); } + if (CONSOLE_LOG === true) { console.log("[INFO] initialize -> readBotsAndPlottersConfig -> onDataArrived -> competition.repo = " + competition.repo); } + try { if (CONSOLE_LOG === true) { @@ -434,6 +446,9 @@ function initialize() { function onFileRead(err, pData) { + if (CONSOLE_LOG === true) { console.log("[INFO] initialize -> readBotsAndPlottersConfig -> onFileRead -> Entering function."); } + if (CONSOLE_LOG === true) { console.log("[INFO] initialize -> readBotsAndPlottersConfig -> onFileRead -> fileName = " + fileName); } + try { responsesReceived++; @@ -471,6 +486,10 @@ function initialize() { function onDataArrived(pData) { + if (CONSOLE_LOG === true) { console.log("[INFO] initialize -> readBotsAndPlottersConfig -> onDataArrived -> Entering function."); } + if (CONSOLE_LOG === true) { console.log("[INFO] initialize -> readBotsAndPlottersConfig -> onDataArrived -> host.codeName = " + host.codeName); } + if (CONSOLE_LOG === true) { console.log("[INFO] initialize -> readBotsAndPlottersConfig -> onDataArrived -> competition.repo = " + competition.repo); } + try { if (CONSOLE_LOG === true) { @@ -512,11 +531,7 @@ function initialize() { function startHtttpServer() { - if (CONSOLE_LOG === true) { - - console.log("I am entering the startHtttpServer function. So far so good."); - - } + if (CONSOLE_LOG === true) { console.log("[INFO] startHtttpServer -> Entering function."); } try { @@ -529,6 +544,9 @@ function startHtttpServer() { function onBrowserRequest(request, response) { + if (CONSOLE_LOG === true) { console.log("[INFO] onBrowserRequest -> Entering function."); } + if (CONSOLE_LOG === true) { console.log("[INFO] onBrowserRequest -> request = " + request); } + var htmlResponse; var requestParameters = request.url.split("/"); @@ -559,6 +577,8 @@ function onBrowserRequest(request, response) { function onFileRead(err, file) { + if (CONSOLE_LOG === true) { console.log("[INFO] onBrowserRequest -> onFileRead -> Entering function."); } + try { let fileContent = file.toString(); @@ -580,6 +600,8 @@ function onBrowserRequest(request, response) { function addToFileContent(pDevTeamsOrHosts) { + if (CONSOLE_LOG === true) { console.log("[INFO] onBrowserRequest -> onFileRead -> addToFileContent -> Entering function."); } + for (let i = 0; i < pDevTeamsOrHosts.length; i++) { let devTeam = pDevTeamsOrHosts[i]; @@ -643,6 +665,8 @@ function onBrowserRequest(request, response) { function onFileRead(err, file) { + if (CONSOLE_LOG === true) { console.log("[INFO] onBrowserRequest -> onFileRead -> Entering function."); } + try { let fileContent = file.toString(); @@ -664,6 +688,8 @@ function onBrowserRequest(request, response) { function addToFileContent(pDevTeamsOrHosts) { + if (CONSOLE_LOG === true) { console.log("[INFO] onBrowserRequest -> onFileRead -> addToFileContent -> Entering function."); } + for (let i = 0; i < pDevTeamsOrHosts.length; i++) { let devTeam = pDevTeamsOrHosts[i]; @@ -731,6 +757,8 @@ function onBrowserRequest(request, response) { function onFileRead(err, file) { + if (CONSOLE_LOG === true) { console.log("[INFO] onBrowserRequest -> onFileRead -> Entering function."); } + try { let fileContent = file.toString(); @@ -823,6 +851,8 @@ function onBrowserRequest(request, response) { function onFileRead(err, file) { + if (CONSOLE_LOG === true) { console.log("[INFO] onBrowserRequest -> onFileRead -> Entering function."); } + try { let fileContent = file.toString(); @@ -832,6 +862,8 @@ function onBrowserRequest(request, response) { function addPlotters() { + if (CONSOLE_LOG === true) { console.log("[INFO] onBrowserRequest -> onFileRead -> addPlotters -> Entering function."); } + let htmlLinePlotter = '' + '\n' + ' ' @@ -846,6 +878,8 @@ function onBrowserRequest(request, response) { function addScript(pDevTeamsOrHosts) { + if (CONSOLE_LOG === true) { console.log("[INFO] onBrowserRequest -> onFileRead -> addPlotters -> addScript -> Entering function."); } + for (let i = 0; i < pDevTeamsOrHosts.length; i++) { let devTeam = pDevTeamsOrHosts[i]; @@ -894,6 +928,8 @@ function onBrowserRequest(request, response) { function addImages() { + if (CONSOLE_LOG === true) { console.log("[INFO] onBrowserRequest -> onFileRead -> addImages -> Entering function."); } + const htmlLine = '' + '\n' + ' ' @@ -903,6 +939,8 @@ function onBrowserRequest(request, response) { function addScript(pDevTeams) { + if (CONSOLE_LOG === true) { console.log("[INFO] onBrowserRequest -> onFileRead -> addImages -> addScript -> Entering function."); } + for (let i = 0; i < pDevTeams.length; i++) { let devTeam = pDevTeams[i]; @@ -993,6 +1031,9 @@ function onBrowserRequest(request, response) { } function sendResponseToBrowser(htmlResponse) { + + if (CONSOLE_LOG === true) { console.log("[INFO] onBrowserRequest -> sendResponseToBrowser -> Entering function."); } + response.writeHead(200, { 'Content-Type': 'text/html' }); response.write(htmlResponse); @@ -1002,6 +1043,8 @@ function onBrowserRequest(request, response) { function respondWithContent(content, response) { + if (CONSOLE_LOG === true) { console.log("[INFO] respondWithContent -> Entering function."); } + try { response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1. @@ -1022,6 +1065,8 @@ function respondWithContent(content, response) { function respondWithFile(fileName, response) { + if (CONSOLE_LOG === true) { console.log("[INFO] respondWithFile -> Entering function."); } + let fs = require('fs'); try { @@ -1029,6 +1074,8 @@ function respondWithFile(fileName, response) { function onFileRead(err, file) { + if (CONSOLE_LOG === true) { console.log("[INFO] respondWithFile -> onFileRead -> Entering function."); } + try { let htmlResponse = file.toString(); @@ -1056,6 +1103,8 @@ function respondWithFile(fileName, response) { function returnEmptyArray() { + if (CONSOLE_LOG === true) { console.log("[INFO] respondWithFile -> returnEmptyArray -> Entering function."); } + response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1. response.setHeader("Pragma", "no-cache"); // HTTP 1.0. response.setHeader("Expires", "0"); // Proxies. @@ -1069,6 +1118,8 @@ function respondWithFile(fileName, response) { function getGithubData(pOrg, pRepo, pPath, callBackFunction) { + if (CONSOLE_LOG === true) { console.log("[INFO] getGithubData -> Entering function."); } + let cacheVersion = githubData.get(pOrg + '.' + pRepo + '.' + pPath) if (cacheVersion !== undefined) { @@ -1104,9 +1155,11 @@ function getGithubData(pOrg, pRepo, pPath, callBackFunction) { function onContent(error, result) { + if (CONSOLE_LOG === true) { console.log("[INFO] getGithubData -> onContent -> Entering function."); } + if (CONSOLE_LOG === true) { - console.log("getGithubData - Github.com responded to request " + pOrg + '.' + pRepo + '.' + pPath + " with result = " + result.toString().substring(0,100)); + console.log("[INFO] getGithubData -> onContent -> Github.com responded to request " + pOrg + '.' + pRepo + '.' + pPath + " with result = " + result.toString().substring(0,100)); }