Add optional $params param into log_append (will log arrays)

This commit is contained in:
tobi132 2019-10-17 12:07:08 +02:00
parent 9250f20559
commit ed14f9ada0

View File

@ -879,8 +879,12 @@ function convert_bytes($size)
return @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $unit[$i];
}
function log_append($file, $str)
function log_append($file, $str, array $params = [])
{
if(count($params) > 0) {
$str .= print_r($params, true);
}
$f = fopen(LOGS . $file, 'ab');
fwrite($f, '[' . date(DateTime::RFC1123) . '] ' . $str . PHP_EOL);
fclose($f);