mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 14:35:47 +01:00
closes #456
This commit is contained in:
@@ -3,11 +3,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
var fs = require('fs'),
|
var fs = require('fs'),
|
||||||
|
path = require('path'),
|
||||||
express = require('express'),
|
express = require('express'),
|
||||||
winston = require('winston'),
|
winston = require('winston'),
|
||||||
util = require('util'),
|
util = require('util'),
|
||||||
socketio = require('socket.io'),
|
socketio = require('socket.io'),
|
||||||
meta = require('./meta.js');
|
meta = require('./meta');
|
||||||
|
|
||||||
var opts = {
|
var opts = {
|
||||||
/*
|
/*
|
||||||
@@ -72,10 +73,20 @@ var opts = {
|
|||||||
/* Open the streams to log to: either a path or stdout */
|
/* Open the streams to log to: either a path or stdout */
|
||||||
var stream;
|
var stream;
|
||||||
if(value && fs.existsSync(value)) {
|
if(value && fs.existsSync(value)) {
|
||||||
stream = fs.createWriteStream(value, {flags: 'a'});
|
fs.stat(value, function(err, stats) {
|
||||||
}
|
if(stats.isDirectory()) {
|
||||||
else
|
stream = fs.createWriteStream(path.join(value, 'nodebb.log'), {flags: 'a'});
|
||||||
|
} else {
|
||||||
|
stream = fs.createWriteStream(value, {flags: 'a'});
|
||||||
|
}
|
||||||
|
stream.on('error', function(err) {
|
||||||
|
winston.error(err.message);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
stream = process.stdout;
|
stream = process.stdout;
|
||||||
|
}
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,8 +123,7 @@ var opts = {
|
|||||||
*/
|
*/
|
||||||
if(meta.config.loggerStatus > 0) {
|
if(meta.config.loggerStatus > 0) {
|
||||||
return opts.express.ofn(req,res,next);
|
return opts.express.ofn(req,res,next);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -140,11 +150,13 @@ var opts = {
|
|||||||
for(var v in clients) {
|
for(var v in clients) {
|
||||||
var client = clients[v];
|
var client = clients[v];
|
||||||
|
|
||||||
if(client.oEmit != undefined && client.oEmit != client.emit)
|
if(client.oEmit != undefined && client.oEmit != client.emit) {
|
||||||
client.emit = client.oEmit;
|
client.emit = client.oEmit;
|
||||||
|
}
|
||||||
|
|
||||||
if(client.$oEmit != undefined && client.$oEmit != client.$emit)
|
if(client.$oEmit != undefined && client.$oEmit != client.$emit) {
|
||||||
client.$emit = client.$oEmit;
|
client.$emit = client.$oEmit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user