v1.18.x
barisusakli 11 years ago
parent b7ee875b12
commit cc3786e22d

@ -12,7 +12,7 @@ var fs = require('fs'),
var logFileName = 'logs/events.log'; var logFileName = 'logs/events.log';
events.logPasswordChange = function(uid) { events.logPasswordChange = function(uid) {
logWithUser(uid, 'changed password'); events.logWithUser(uid, 'changed password');
}; };
events.logAdminChangeUserPassword = function(adminUid, theirUid, callback) { events.logAdminChangeUserPassword = function(adminUid, theirUid, callback) {
@ -35,43 +35,42 @@ var fs = require('fs'),
} }
events.logPasswordReset = function(uid) { events.logPasswordReset = function(uid) {
logWithUser(uid, 'reset password'); events.logWithUser(uid, 'reset password');
}; };
events.logEmailChange = function(uid, oldEmail, newEmail) { events.logEmailChange = function(uid, oldEmail, newEmail) {
logWithUser(uid,'changed email from "' + oldEmail + '" to "' + newEmail +'"'); events.logWithUser(uid,'changed email from "' + oldEmail + '" to "' + newEmail +'"');
}; };
events.logUsernameChange = function(uid, oldUsername, newUsername) { events.logUsernameChange = function(uid, oldUsername, newUsername) {
logWithUser(uid,'changed username from "' + oldUsername + '" to "' + newUsername +'"'); events.logWithUser(uid,'changed username from "' + oldUsername + '" to "' + newUsername +'"');
}; };
events.logAdminLogin = function(uid) { events.logAdminLogin = function(uid) {
logWithUser(uid, 'logged into admin panel'); events.logWithUser(uid, 'logged into admin panel');
}; };
events.logPostEdit = function(uid, pid) { events.logPostEdit = function(uid, pid) {
logWithUser(uid, 'edited post (pid ' + pid + ')'); events.logWithUser(uid, 'edited post (pid ' + pid + ')');
}; };
events.logPostDelete = function(uid, pid) { events.logPostDelete = function(uid, pid) {
logWithUser(uid, 'deleted post (pid ' + pid + ')'); events.logWithUser(uid, 'deleted post (pid ' + pid + ')');
}; };
events.logPostRestore = function(uid, pid) { events.logPostRestore = function(uid, pid) {
logWithUser(uid, 'restored post (pid ' + pid + ')'); events.logWithUser(uid, 'restored post (pid ' + pid + ')');
}; };
events.logTopicDelete = function(uid, tid) { events.logTopicDelete = function(uid, tid) {
logWithUser(uid, 'deleted topic (tid ' + tid + ')'); events.logWithUser(uid, 'deleted topic (tid ' + tid + ')');
}; };
events.logTopicRestore = function(uid, tid) { events.logTopicRestore = function(uid, tid) {
logWithUser(uid, 'restored topic (tid ' + tid + ')'); events.logWithUser(uid, 'restored topic (tid ' + tid + ')');
}; };
function logWithUser(uid, string) { events.logWithUser = function(uid, string) {
user.getUserField(uid, 'username', function(err, username) { user.getUserField(uid, 'username', function(err, username) {
if(err) { if(err) {
return winston.error('Error logging event. ' + err.message); return winston.error('Error logging event. ' + err.message);

@ -40,6 +40,7 @@ SocketAdmin.before = function(socket, method, next) {
}; };
SocketAdmin.reload = function(socket, data, callback) { SocketAdmin.reload = function(socket, data, callback) {
events.logWithUser(socket.uid, ' is reloading NodeBB');
if (cluster.isWorker) { if (cluster.isWorker) {
process.send({ process.send({
action: 'reload' action: 'reload'
@ -50,6 +51,7 @@ SocketAdmin.reload = function(socket, data, callback) {
}; };
SocketAdmin.restart = function(socket, data, callback) { SocketAdmin.restart = function(socket, data, callback) {
events.logWithUser(socket.uid, ' is restarting NodeBB');
meta.restart(); meta.restart();
}; };

Loading…
Cancel
Save