Magento 2 – quick datalog using bootstap.php

Posted on May 27, 2021 by jamie

function printLog($myArray, $exit=0)
{
    $writer = new \Zend\Log\Writer\Stream(BP . '/var/log/logfile.log');
    $logger = new \Zend\Log\Logger();
    $logger->addWriter($writer);
    $logger->info('Array Log'.print_r($myArray, true)); // Array Log
    if ($exit) {
        exit;
    }
}