From 271356d506cb7fdcd1d001cd32398eaffe7dc979 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Thu, 29 Jan 2015 13:20:10 +0000 Subject: [PATCH] logger : allow to remove more entries in the dump stack to find the right file calling the logger git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1964 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- logger.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/logger.php b/logger.php index 0c56662..321b4d0 100644 --- a/logger.php +++ b/logger.php @@ -31,6 +31,9 @@ class logger public $syslogFacility = LOG_USER; /** In Syslog, prefix the log by the text */ public $syslogPrefix = FALSE; + /** Remove X entries of backtrace to see the right file generating the error + */ + public $backTraceSkip = 0; /** The priorities which can be used in the priorities LOG_EMERG system is unusable @@ -60,7 +63,8 @@ class logger if ($this->loglevelmin < $priority) return; $backtrace = debug_backtrace(); - $back = reset ($backtrace); + for ($i = 0 ; $i <= $this->backTraceSkip ; $i++) + $back = array_shift ($backtrace); $msg = ""; if (isset ($_SERVER["REMOTE_ADDR"])) {