Add a logging facility, and instrument login/logout to use it.

This commit is contained in:
Bharat Mediratta
2008-12-21 03:50:11 +00:00
parent a19a4729b5
commit f0b6333344
6 changed files with 107 additions and 16 deletions
+16
View File
@@ -187,6 +187,22 @@ class user_Core {
user::set_active($user);
module::event("user_login", $user);
log::add("user", "User $user->name logged in",
log::INFO, html::anchor("user/$user->id", $user->name));
}
public static function logout() {
$user = user::active();
if (!$user->guest) {
try {
Session::instance()->destroy();
} catch (Exception $e) {
Kohana::log("error", $e);
}
module::event("user_logout", $user);
log::add("user", "User $user->name logged out",
log::INFO, html::anchor("user/$user->id", $user->name));
}
}
/**