Added gather logging

This commit is contained in:
Chris Blanchard 2015-09-14 22:40:49 +01:00
parent 0d592c85b5
commit 7005c58082

View file

@ -23,6 +23,7 @@ var Map = require("./map");
var Server = require("./server");
var Gather = require("./gather_singleton");
var _ = require("lodash");
var winston = require("winston");
module.exports = function (namespace) {
var refreshGather = _.debounce(function () {
@ -54,6 +55,7 @@ module.exports = function (namespace) {
socket.on("gather:join", function (data) {
let gather = Gather.current;
if (gather.can("addGatherer")) gather.addGatherer(socket._user);
winston.info("Gather Joiner", JSON.stringify(socket._user));
refreshGather();
});
@ -67,6 +69,7 @@ module.exports = function (namespace) {
socket.on("gather:leave", function (data) {
let gather = Gather.current;
if (gather.can("removeGatherer")) gather.removeGatherer(socket._user);
winston.info("Gather Leaver", JSON.stringify(socket._user));
refreshGather();
});
@ -97,6 +100,10 @@ module.exports = function (namespace) {
gather.confirmSelection(socket._user);
}
winston.info("Selection Data",
JSON.stringify(socket._user),
JSON.stringify(data));
refreshGather();
});
@ -118,6 +125,10 @@ module.exports = function (namespace) {
gather.voteForServer(socket._user, data.server.id);
}
winston.info("Vote Data",
JSON.stringify(socket._user),
JSON.stringify(data));
refreshGather();
});