I want to check if a customer is logged or not. And if he/she logged, I want to get the customerId. I just googled but I could find 2 ways.
One is to use CustomerSession:
Another one is to use Customer\Model\Context.
Which is right way? These 2 articles show different way. I am really confusing what I should use. http://www.blogtreat.com/get-logged-in-customer-data-in-magento-2/