Skip to content

Instantly share code, notes, and snippets.

@DavidVaini
Created December 3, 2018 22:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidVaini/5bdd6bfacce20de6134ae6301a754c9d to your computer and use it in GitHub Desktop.
Save DavidVaini/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');
@DavidVaini
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