diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-03-29 11:24:29 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-05-07 09:04:07 +0200 |
commit | a2df8a4746dd9c355541501e78726daaa6dbec43 (patch) | |
tree | a0fef8664d3b2ae1868d7b9d364e4932ae77931c /apps/admin_audit | |
parent | 1e12db35ee3b7ec96577129c6895c878e6204666 (diff) | |
download | nextcloud-server-a2df8a4746dd9c355541501e78726daaa6dbec43.tar.gz nextcloud-server-a2df8a4746dd9c355541501e78726daaa6dbec43.zip |
Audit: Log messages with separate function
Diffstat (limited to 'apps/admin_audit')
-rw-r--r-- | apps/admin_audit/lib/hooks_handlers.php | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/apps/admin_audit/lib/hooks_handlers.php b/apps/admin_audit/lib/hooks_handlers.php index 8ebabbac7b5..4cc3194eaf1 100644 --- a/apps/admin_audit/lib/hooks_handlers.php +++ b/apps/admin_audit/lib/hooks_handlers.php @@ -3,47 +3,50 @@ class OC_Admin_Audit_Hooks_Handlers { static public function pre_login($params) { $path = $params['uid']; - OCP\Util::writeLog('admin_audit', 'Trying login '.$user, OCP\Util::INFO); + self::log('Trying login '.$user); } static public function post_login($params) { $path = $params['uid']; - OCP\Util::writeLog('admin_audit', 'Login '.$user, OCP\Util::INFO); + self::log('Login '.$user); } static public function logout($params) { $user = OCP\User::getUser(); - OCP\Util::writeLog('admin_audit', 'Logout '.$user, OCP\Util::INFO); + self::log('Logout '.$user); } static public function rename($params) { $oldpath = $params[OC_Filesystem::signal_param_oldpath]; $newpath = $params[OC_Filesystem::signal_param_newpath]; $user = OCP\User::getUser(); - OCP\Util::writeLog('admin_audit', 'Rename "'.$oldpath.'" to "'.$newpath.'" by '.$user, OCP\Util::INFO); + self::log('Rename "'.$oldpath.'" to "'.$newpath.'" by '.$user); } static public function create($params) { $path = $params[OC_Filesystem::signal_param_path]; $user = OCP\User::getUser(); - OCP\Util::writeLog('admin_audit', 'Create "'.$path.'" by '.$user, OCP\Util::INFO); + self::log('Create "'.$path.'" by '.$user); } static public function copy($params) { $oldpath = $params[OC_Filesystem::signal_param_oldpath]; $newpath = $params[OC_Filesystem::signal_param_newpath]; $user = OCP\User::getUser(); - OCP\Util::writeLog('admin_audit', 'Copy "'.$oldpath.'" to "'.$newpath.'" by '.$user, OCP\Util::INFO); + self::log('Copy "'.$oldpath.'" to "'.$newpath.'" by '.$user); } static public function write($params) { $path = $params[OC_Filesystem::signal_param_path]; $user = OCP\User::getUser(); - OCP\Util::writeLog('admin_audit', 'Write "'.$path.'" by '.$user, OCP\Util::INFO); + self::log('Write "'.$path.'" by '.$user); } static public function read($params) { $path = $params[OC_Filesystem::signal_param_path]; $user = OCP\User::getUser(); - OCP\Util::writeLog('admin_audit', 'Read "'.$path.'" by '.$user, OCP\Util::INFO); + self::log('Read "'.$path.'" by '.$user); } static public function delete($params) { $path = $params[OC_Filesystem::signal_param_path]; $user = OCP\User::getUser(); - OCP\Util::writeLog('admin_audit', 'Delete "'.$path.'" by '.$user, OCP\Util::INFO); + self::log('Delete "'.$path.'" by '.$user); + } + static protected function log($msg) { + OCP\Util::writeLog('admin_audit', $msg, OCP\Util::INFO); } } |