Added even more log readability inprovements, added links to text datas on main page

This commit is contained in:
YourFriendlyNeighborhoodDealer 2018-11-25 09:23:16 +01:00
parent d50ff5c448
commit 06dc1078bb
2 changed files with 14 additions and 13 deletions

View file

@ -73,16 +73,23 @@ function Process(d, file) {
function ProcessIncomingRequest(data) { function ProcessIncomingRequest(data) {
logger.Log("[PCES] ----------------------------------------------------------<",
logger.GetColor("yellow"));
if (data == undefined) { if (data == undefined) {
logger.Log("[PCES]:\tRecieved data is undefined!", logger.GetColor("redbg")); logger.Log("[PCES]:\tRecieved data is undefined!", logger.GetColor("redbg"));
return; return;
} }
var d = SetupData(data); var d = SetupData(data);
var qcount = -1;
try {
var splitted = d.alldata.split("\n");
var count = 0;
for (var i = 0; i < splitted.length; i++)
if (splitted[i][0] == '?')
count ++;
qcount = count;
} catch (e) {console.log("Error :c"); console.log(e);}
logger.Log("[PCES]:\tProcessing data: " + d.subj + " (" + d.type + ")", logger.GetColor("green")); logger.Log("[PCES]:\tProcessing data: " + d.subj + " (" + d.type + "), count: " + qcount, logger.GetColor("green"));
if (d.subj == undefined){ if (d.subj == undefined){
logger.Log(JSON.stringify(d), logger.GetColor("red")); logger.Log(JSON.stringify(d), logger.GetColor("red"));
return; return;
@ -99,22 +106,12 @@ function ProcessIncomingRequest(data) {
Process(d, publicFile); Process(d, publicFile);
Process(d, staticFile); Process(d, staticFile);
}*/ }*/
try {
var splitted = d.alldata.split("\n");
var count = 0;
for (var i = 0; i < splitted.length; i++)
if (splitted[i][0] == '?')
count ++;
logger.Log("[PCES]:\tTest all question count: " + count, logger.GetColor("blue"));
} catch (e) {console.log("Error :c"); console.log(e);}
var newPubItems = Process(d, publicFile); var newPubItems = Process(d, publicFile);
var newStatItems = Process(d, staticFile); var newStatItems = Process(d, staticFile);
utils.AppendToFile(logger.GetDateString() + "\n" + d.data, recievedFile); utils.AppendToFile(logger.GetDateString() + "\n" + d.data, recievedFile);
PrintNewCount(d, newPubItems, publicFile); PrintNewCount(d, newPubItems, publicFile);
PrintNewCount(d, newStatItems, staticFile); PrintNewCount(d, newStatItems, staticFile);
logger.Log("[PCES] ----------------------------------------------------------<",
logger.GetColor("yellow"));
} }
function PrintNewCount(d, newItems, file) { function PrintNewCount(d, newItems, file) {

View file

@ -33,6 +33,8 @@ greasyforkon</a>
<form action="/postquestions", method="post"> <form action="/postquestions", method="post">
<a href="http://questionmining.tk/public">Szabadon szerkeszthető adatok</a>
</br>
<textarea id="name" type="text" name="data_field"><%= pdata %></textarea> <textarea id="name" type="text" name="data_field"><%= pdata %></textarea>
</br> </br>
<button style="width: 100%">Mentés</button> <button style="width: 100%">Mentés</button>
@ -42,6 +44,8 @@ greasyforkon</a>
<td > <td >
<a href="http://questionmining.tk/static">Karbantartott adatok</a>
</br>
<textarea readonly ><%= sdata %></textarea> <textarea readonly ><%= sdata %></textarea>
</td> </td>