Log shit to a file and tail that shit
<?php
/**
* Log to console file
*/
function console_log() {
$args = func_get_args();
$logs = [];
foreach ($args as $arg) {
if (is_array($arg) || is_object($arg)) {
$logs[] = json_encode($arg);
} else {
$logs[] = $arg;
}
}
$log = implode(' ', $logs);
file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/console.log', '');
file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/console.log', $log . PHP_EOL, FILE_APPEND | LOCK_EX);
}
?>