From 81fbbb7da8e61db0fdbe16f8d532c722ae860b0b Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Mon, 11 May 2015 11:17:44 +0000 Subject: [PATCH] logger : allow the types of log to be a string or already an array git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2162 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- logger.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/logger.php b/logger.php index 09aa7ff..cb36821 100644 --- a/logger.php +++ b/logger.php @@ -18,7 +18,7 @@ class logger // TODO : Add SQL support /** The method to log. Can be display, file, syslog - Can be merged with a pipe : "display|syslog|file"*/ + Can be merged with a pipe : "display|syslog|file" or put in array */ public $logtype = "display"; /** For logtype=file, the filename to use */ public $logfile = FALSE; @@ -135,7 +135,10 @@ class logger // Add the filename which generate the error $msg .= " [".basename ($back["file"]).":".$back["line"]."]"; - $logsType = explode ("|", $this->logtype); + if (is_string ($this->logtype)) + $logsType = explode ("|", $this->logtype); + elseif (is_array ($this->logtype)) + $logsType = $this->logtype; if (in_array ("display", $logsType)) $this->logdisplay ($msg, $priority); if (in_array ("file", $logsType))