Magento 2.x – Add log within one single line of code
If you are trying to debug in a remote server, or just want to temporary add a debug message. Then the following snippet would help you, adding your log to the debug.log file
1 |
\Magento\Framework\App\ObjectManager::getInstance()->get(\Psr\Log\LoggerInterface::class)->debug('This is my message'); |
Enjoy!