Log the client ip on pad access with logger 'access'

also, don't log every message with log level info!
This commit is contained in:
Marcel Klehr 2013-02-10 16:03:49 +01:00
parent 6191b01633
commit ee89696c4d
2 changed files with 12 additions and 2 deletions

View file

@ -55,13 +55,14 @@ exports.setSocketIO = function(_socket)
socket.sockets.on('connection', function(client)
{
client.set('remoteAddress', client.handshake.address.address);
var clientAuthorized = false;
//wrap the original send function to log the messages
client._send = client.send;
client.send = function(message)
{
messageLogger.info("to " + client.id + ": " + stringifyWithoutPassword(message));
messageLogger.debug("to " + client.id + ": " + stringifyWithoutPassword(message));
client._send(message);
}
@ -79,7 +80,7 @@ exports.setSocketIO = function(_socket)
//check if component is registered in the components array
if(components[message.component])
{
messageLogger.info("from " + client.id + ": " + stringifyWithoutPassword(message));
messageLogger.debug("from " + client.id + ": " + stringifyWithoutPassword(message));
components[message.component].handleMessage(client, message);
}
}