Magento2 log messages

Hi, In this wiki  we will show you how we can logging in Magento2 

as you know in Magento1, we can doing log by this code

<?php

Mage::log("You message here");

?>

but in magento2 this code will not work, we can easily log by this code

in your file just you need to make new instance of Object Manager, then we will create a new object of LoogerInterface

<?php

$om =   \Magento\Framework\App\ObjectManager::getInstance();

$logger =     $om->create('\Psr\Log\LoggerInterface');

$logger->addDebug("your message here"); // log location: var/log/system.log

$logger->addInfo("your message here"); // log location: var/log/exception.log

$logger->addNotice("your message here"); // log location: var/log/exception.log

$logger->addError("your message here"); // log location: var/log/exception.log

$logger->critical("your message here"); // log location: var/log/exception.log
$logger->info("your message here");
$logger->debug("your message here");
 

?>

in case you see this wiki is usefull , please like our page on facebook WIKI CODE