summaryrefslogtreecommitdiffstats
path: root/index.js
diff options
context:
space:
mode:
authorokalintu <ilkka.oksanen@aalto.fi>2015-03-09 16:12:45 +0200
committerokalintu <ilkka.oksanen@aalto.fi>2015-03-09 16:12:45 +0200
commitf5e82d12e4e5cf2959a38b73271abc2eab434519 (patch)
tree8ab28dc2d797b6ab4b231a61cb322800f595be27 /index.js
parentf607dac15deb8b9faeb060661ccf8edd2b9564fc (diff)
sanitized log and added outdated property to admin
Diffstat (limited to 'index.js')
-rw-r--r--index.js21
1 files changed, 15 insertions, 6 deletions
diff --git a/index.js b/index.js
index bc02e82..04f62fb 100644
--- a/index.js
+++ b/index.js
@@ -29,15 +29,15 @@ io.on('connection', function(socket){
socket.on("queadd",function(data){
- console.log("adding new que entry with user :" );
+ log("adding new que entry with user: " +data.name+ " , row " +data.row);
data.qid= Date.now();
que.push(data);
io.emit("quedata",que);
});
socket.on("quepopfirst",function(data){
- console.log("deleting first from que");
- que.shift();
+ var deleted = que.shift();
+ log("admin deleted "+ deleted.name +" from que");
io.emit("quedata",que);
});
@@ -48,7 +48,7 @@ io.on('connection', function(socket){
socket.emit("err",{"msg":"you're not allowed to remove this entry"});
break;
}
- console.log("deleting: "+ que[i].name);
+ log(que[i].name+" deleted himself from que");
que.splice(i,1);
io.emit("quedata",que);
break;
@@ -58,6 +58,15 @@ io.on('connection', function(socket){
});
-http.listen(3000, function(){
- console.log('listening on *:3000');
+function getTimeString()
+{
+ return Date().toLocaleString();
+}
+
+function log(msg){
+ console.log(getTimeString()+": "+msg);
+}
+
+http.listen(80, function(){
+ log('listening on *:80');
});