logger : remove the dependency for PHP 5.6 by using standard functions instead of ... for Variable-length argument lists
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1969 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -56,9 +56,10 @@ class logger
|
|||||||
/** Store a new message log in the log manager defined by $logtype
|
/** Store a new message log in the log manager defined by $logtype
|
||||||
The message can be multiple types. An array will be stored in textual form
|
The message can be multiple types. An array will be stored in textual form
|
||||||
but it will accept only one depth.
|
but it will accept only one depth.
|
||||||
|
The $message is not fixed, you can pass the number of parameters you want
|
||||||
@param integer|null $priority Priority to use
|
@param integer|null $priority Priority to use
|
||||||
@param mixed ...$message Message to log */
|
@param mixed ...$message Message to log */
|
||||||
public function log ($priority=LOG_NOTICE, ...$message)
|
public function log ($priority=LOG_NOTICE, $message)
|
||||||
{
|
{
|
||||||
if ($this->loglevelmin < $priority)
|
if ($this->loglevelmin < $priority)
|
||||||
return;
|
return;
|
||||||
@@ -71,8 +72,12 @@ class logger
|
|||||||
$msg .= "[".$_SERVER["REMOTE_ADDR"]."] ";
|
$msg .= "[".$_SERVER["REMOTE_ADDR"]."] ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The messages are all the parameters of the function except the first,
|
||||||
|
// which is the priority
|
||||||
|
$messages = func_get_args ();
|
||||||
|
array_shift ($messages);
|
||||||
// Convert each part of message to text
|
// Convert each part of message to text
|
||||||
foreach ($message as $m)
|
foreach ($messages as $m)
|
||||||
{
|
{
|
||||||
if (is_array ($m))
|
if (is_array ($m))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user