From f48687528e1f9b6b08a153eb7fc28d8af35c2534 Mon Sep 17 00:00:00 2001 From: Andrew Darqui Date: Wed, 2 Oct 2013 01:28:37 -0400 Subject: [PATCH] fixed up logger.tpl a little. Added a basic 'collision detection' for the loggerPath and loggeIOPath filenames. --- public/templates/admin/logger.tpl | 8 +++++--- src/websockets.js | 23 +++-------------------- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/public/templates/admin/logger.tpl b/public/templates/admin/logger.tpl index e47d330f95..969647f820 100644 --- a/public/templates/admin/logger.tpl +++ b/public/templates/admin/logger.tpl @@ -5,16 +5,17 @@

- By enabling the check box, you will receive http logs to standard output. If you specify a path, logs will then be saved to a file instead. + By enabling the check boxes, you will receive logs to standard output. If you specify a path, logs will then be saved to a file instead. HTTP logging is useful for collecting statistics about who and when people access your forum. Socket.io logging, in combination with redis-cli monitor, can be very helpful for learning NodeBB's internals.



+
@@ -23,9 +24,10 @@

+
diff --git a/src/websockets.js b/src/websockets.js index 04d2b96c93..6f2841650a 100644 --- a/src/websockets.js +++ b/src/websockets.js @@ -57,25 +57,6 @@ module.exports.init = function(io) { sessionID, uid; - -/* -(function() { - var emit = socket.emit; - socket.emit = function() { - console.log('***','emit', Array.prototype.slice.call(arguments)); - emit.apply(socket, arguments); - }; - var $emit = socket.$emit; - socket.$emit = function() { - console.log('***','on',Array.prototype.slice.call(arguments)); - $emit.apply(socket, arguments); - }; -})(); -*/ - - - - // Validate the session, if present socketCookieParser(hs, {}, function(err) { sessionID = socket.handshake.signedCookies["express.sid"]; @@ -103,7 +84,9 @@ module.exports.init = function(io) { if(!meta.config.loggerIOStream) { var loggerObj = {}; if(meta.config.loggerIOPath) { - loggerObj.stream = fs.createWriteStream(meta.config.loggerIOPath, {flags: 'a'}); + var actual_path = meta.config.loggerIOPath; + if(meta.config.loggerIOPath == meta.config.loggerPath) { actual_path = actual_path + ".io.log"; } + loggerObj.stream = fs.createWriteStream(actual_path, {flags: 'a'}); } else { loggerObj.stream = process.stdout;