From ed14f9ada015c02a9fbe57c1413c29c6a48f0ca7 Mon Sep 17 00:00:00 2001 From: tobi132 Date: Thu, 17 Oct 2019 12:07:08 +0200 Subject: [PATCH] Add optional $params param into log_append (will log arrays) --- system/functions.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/system/functions.php b/system/functions.php index 531eb472..564c15cd 100644 --- a/system/functions.php +++ b/system/functions.php @@ -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);