How to check customer is logged in or not in magento

$check_login=Mage::getSingleton("customer/session")->isLoggedIn();
if(!$check_login){
echo 'Not Logged in';
}else{
echo 'logged in';
}