Strange logging error
| From: | Michael Dransfield | Date: | Sat, 22 Jun 2002 16:49:09 +0000 |
| Subject: | Strange logging error | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-7346@lists.php.net to get a copy of this message | ||
I am trying to write a simple logging script to record when users log in / log out / failed logins etc
I am using this code
$l = new Log_file('logs/user_login.log', 'user_login');
$l->log("LOGIN : $user_name", LOG_INFO);
$l->close();
but the log file always records debug not info
I added a print_r to the priorityToString() function (just before return statement), which outputs the following
Array (
[1] => critical
[4] => error
[5] => warning
[6] => debug
)
what has happened to the others??
function priorityToString($priority)
{
$priorities = array(
LOG_EMERG => 'emergency',
LOG_ALERT => 'alert',
LOG_CRIT => 'critical',
LOG_ERR => 'error',
LOG_WARNING => 'warning',
LOG_NOTICE => 'notice',
LOG_INFO => 'info',
LOG_DEBUG => 'debug'
);
print_r($priorities);
return $priorities[$priority]; // returns debug even if i pass LOG_INFO
}