Skip to content

Instantly share code, notes, and snippets.

@davidvthecoder
Created December 3, 2018 22:51
Show Gist options
  • Save davidvthecoder/5bdd6bfacce20de6134ae6301a754c9d to your computer and use it in GitHub Desktop.
Save davidvthecoder/5bdd6bfacce20de6134ae6301a754c9d to your computer and use it in GitHub Desktop.
simple inline logger for magento 2 to do simple testing on things that cant dump to page.
$writer = new \Zend\Log\Writer\Stream(BP . '/var/log/logfile.log');
$logger = new \Zend\Log\Logger();
$logger->addWriter($writer);
$logger->info('message/var to log');
@davidvthecoder
Copy link
Author

or try this for 2.3.4
$writer = new \Zend_Log_Writer_Stream(BP . '/var/log/vsp.log'); $logger = new \Zend_Log(); $logger->addWriter($writer); $logger->info('text message');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment