Skip to content

Node.js based forum software built for the modern web

fixed up logger.tpl a little. Added a basic 'collision detection' for the loggerPath and loggeIOPath filenames.

Andrew Darquif48687528e1f
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 @@
<div class="alert alert-warning">
<p>
- 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.
</p>
<br/>
<form>
<label>
- <input type="checkbox" data-field="loggerStatus"> <strong>Enable logging</strong>
+ <input type="checkbox" data-field="loggerStatus"> <strong>Enable HTTP logging</strong>
</label>
<br/>
+ <br/>
<label>Path to log file</label>
<input class="form-control" type="text" placeholder="/path/to/log/file.log" data-field="loggerPath" />
@@ -23,9 +24,10 @@
<br/>
<label>
- <input type="checkbox" data-field="loggerIOStatus"> <strong>Enable socket.io logging</strong>
+ <input type="checkbox" data-field="loggerIOStatus"> <strong>Enable socket.io event logging</strong>
</label>
<br/>
+ <br/>
<label>Path to socket.io log file</label>
<input class="form-control" type="text" placeholder="/path/to/log/socket.io.file.log" data-field="loggerIOPath" />
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;