From cc3786e22dd904ed571b141f83351b5cefbc52d6 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Sat, 6 Sep 2014 22:28:09 -0400 Subject: [PATCH] closes #2055 --- src/events.js | 23 +++++++++++------------ src/socket.io/admin.js | 2 ++ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/events.js b/src/events.js index 64b76fdfdd..3bb4c1c78a 100644 --- a/src/events.js +++ b/src/events.js @@ -12,7 +12,7 @@ var fs = require('fs'), var logFileName = 'logs/events.log'; events.logPasswordChange = function(uid) { - logWithUser(uid, 'changed password'); + events.logWithUser(uid, 'changed password'); }; events.logAdminChangeUserPassword = function(adminUid, theirUid, callback) { @@ -35,43 +35,42 @@ var fs = require('fs'), } events.logPasswordReset = function(uid) { - logWithUser(uid, 'reset password'); + events.logWithUser(uid, 'reset password'); }; 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) { - logWithUser(uid,'changed username from "' + oldUsername + '" to "' + newUsername +'"'); + events.logWithUser(uid,'changed username from "' + oldUsername + '" to "' + newUsername +'"'); }; events.logAdminLogin = function(uid) { - logWithUser(uid, 'logged into admin panel'); + events.logWithUser(uid, 'logged into admin panel'); }; events.logPostEdit = function(uid, pid) { - logWithUser(uid, 'edited post (pid ' + pid + ')'); + events.logWithUser(uid, 'edited post (pid ' + pid + ')'); }; events.logPostDelete = function(uid, pid) { - logWithUser(uid, 'deleted post (pid ' + pid + ')'); + events.logWithUser(uid, 'deleted post (pid ' + pid + ')'); }; events.logPostRestore = function(uid, pid) { - logWithUser(uid, 'restored post (pid ' + pid + ')'); + events.logWithUser(uid, 'restored post (pid ' + pid + ')'); }; events.logTopicDelete = function(uid, tid) { - logWithUser(uid, 'deleted topic (tid ' + tid + ')'); + events.logWithUser(uid, 'deleted topic (tid ' + 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) { if(err) { return winston.error('Error logging event. ' + err.message); diff --git a/src/socket.io/admin.js b/src/socket.io/admin.js index 5ba9e1fff7..aaecf9ad5d 100644 --- a/src/socket.io/admin.js +++ b/src/socket.io/admin.js @@ -40,6 +40,7 @@ SocketAdmin.before = function(socket, method, next) { }; SocketAdmin.reload = function(socket, data, callback) { + events.logWithUser(socket.uid, ' is reloading NodeBB'); if (cluster.isWorker) { process.send({ action: 'reload' @@ -50,6 +51,7 @@ SocketAdmin.reload = function(socket, data, callback) { }; SocketAdmin.restart = function(socket, data, callback) { + events.logWithUser(socket.uid, ' is restarting NodeBB'); meta.restart(); };