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:
@@ -18,7 +18,7 @@ class logger
|
|||||||
// TODO : Add SQL support
|
// TODO : Add SQL support
|
||||||
/** The method to log.
|
/** The method to log.
|
||||||
Can be display, file, syslog
|
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";
|
public $logtype = "display";
|
||||||
/** For logtype=file, the filename to use */
|
/** For logtype=file, the filename to use */
|
||||||
public $logfile = FALSE;
|
public $logfile = FALSE;
|
||||||
@@ -135,7 +135,10 @@ class logger
|
|||||||
// Add the filename which generate the error
|
// Add the filename which generate the error
|
||||||
$msg .= " [".basename ($back["file"]).":".$back["line"]."]";
|
$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))
|
if (in_array ("display", $logsType))
|
||||||
$this->logdisplay ($msg, $priority);
|
$this->logdisplay ($msg, $priority);
|
||||||
if (in_array ("file", $logsType))
|
if (in_array ("file", $logsType))
|
||||||
|
|||||||
Reference in New Issue
Block a user