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
This commit is contained in:
2015-05-11 11:17:44 +00:00
parent 6fbea5dc56
commit 81fbbb7da8

View File

@@ -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))