I added Monolog v.1.24.0 to my project.
Create a logger:
$logger = new Logger('db');
$logger->setTimezone(DateTime::getTimezone());
$logger->pushHandler(new StreamHandler(ROOT.'/log/db.log', Logger::DEBUG, 600));
Now at some point later in the code I construct a message and send it to browser:
// $result contains my array
$tmp = \json_encode($result, JSON_UNESCAPED_UNICODE | JSON_PRESERVE_ZERO_FRACTION | JSON_UNESCAPED_SLASHES);
echo $tmp;
$logger->notice($tmp);
My problem is that I want to extract the time info contained in the log stored at db.log
and include to that echoed to the user.
How is that possible?
PS: I can construct the time by myself but then it's better to delete the whole Monolog project and use my own!