add write runing log func do_log()

This commit is contained in:
xiaomlove
2021-01-05 20:52:55 +08:00
parent 752e26000c
commit 47ba5397a3

View File

@@ -4401,4 +4401,23 @@ function dd($vars)
echo '</pre>';
exit(0);
}
function do_log($log)
{
global $TWEAK;
if (!empty($TWEAK['logging'])) {
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
$content = sprintf(
"[%s] %s%s%s %s%s",
date('Y-m-d H:i:s'),
$backtrace[1]['class'] ?? '',
$backtrace[1]['type'] ?? '',
$backtrace[1]['function'] ?? '',
$log,
PHP_EOL
);
file_put_contents($TWEAK['logging'], $content, FILE_APPEND);
}
}
?>