Methods to get logged in customer data in Magento 2:
using Object Manager
$customerSession = $om->get('Magento\Customer\Model\Session');
$customerData = $customerSession->getCustomer()->getData(); //get all data of customerData
$customerData = $customerSession->getCustomer()->getId();//get id of customer
using Block class
protected $customer;
public function __construct(\Magento\Customer\Model\Session $customer)
{
$this->customer = $customer;
}
public function yourMethodName()
{
$customer = $this->customer;
$customerName = $customer->getName();
$customerId = $customer->getId();
//You will get all basic detail with this $customer object
}