mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 14:35:47 +01:00
fixed up logger.tpl a little. Added a basic 'collision detection' for the loggerPath and loggeIOPath filenames.
This commit is contained in:
@@ -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" />
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user