I have used the following code to check the user is logged or not. It always show me "Login Failed" after the user is logged to the site also.
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$customerSession = $objectManager->get('Magento\Customer\Model\Session');
if($customerSession->isLoggedIn())
{
echo'login success';
}
else {
echo 'login failed';
}