Skip to content

Commit e661950

Browse files
committed
feat(app): improved socket.io logging
1 parent 6f60e58 commit e661950

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: app/templates/server/config/socketio(socketio).js

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function onDisconnect(socket) {
1414
function onConnect(socket) {
1515
// When the client emits 'info', this listens and executes
1616
socket.on('info', function(data) {
17-
console.info('[%s] %s', socket.address, JSON.stringify(data, null, 2));
17+
console.info(`SocketIO ${socket.nsp.name} [${socket.address}] ${JSON.stringify(data, null, 2)}`);
1818
});
1919

2020
// Insert sockets below
@@ -46,11 +46,11 @@ module.exports = function(socketio) {
4646
// Call onDisconnect.
4747
socket.on('disconnect', function() {
4848
onDisconnect(socket);
49-
console.info('[%s] DISCONNECTED', socket.address);
49+
console.info(`SocketIO ${socket.nsp.name} [${socket.address}] DISCONNECTED`);
5050
});
5151

5252
// Call onConnect.
5353
onConnect(socket);
54-
console.info('[%s] CONNECTED', socket.address);
54+
console.info(`SocketIO ${socket.nsp.name} [${socket.address}] CONNECTED`);
5555
});
5656
};

0 commit comments

Comments
 (0)