From 01a5ac92a8363285f84689274ade0dbda30e5a41 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 4 Sep 2014 23:13:46 -0700 Subject: improved logging if you're using php54 or later --- include/text.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index 7da6a8f2b..50c68b6b2 100644 --- a/include/text.php +++ b/include/text.php @@ -508,8 +508,14 @@ function logger($msg,$level = 0) { if((! $debugging) || (! $logfile) || ($level > $loglevel)) return; - - @file_put_contents($logfile, datetime_convert() . ':' . session_id() . ' ' . $msg . "\n", FILE_APPEND); + + $where = ''; + if(version_compare(PHP_VERSION,'5.4.0') >= 0) { + $stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS,2); + $where = basename($stack[0]['file']) . ':' . $stack[0]['line'] . ':' . $stack[1]['function'] . ': '; + } + + @file_put_contents($logfile, datetime_convert() . ':' . session_id() . ' ' . $where . $msg . "\n", FILE_APPEND); return; } -- cgit v1.2.3