Re: Re: Possible problem in PEAR Log
| From: | Michael Dransfield | Date: | Thu, 04 Jul 2002 14:29:31 +0000 |
| Subject: | Re: Re: Possible problem in PEAR Log | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-7470@lists.php.net to get a copy of this message | ||
Below is the function so that syslog works properly with the PEAR_LOG_* changes
This change is needed in syslog.php
syslog($priority, $message);
syslog(Log::pearToSys($priority), $message);
This line could check the OS before calling pearToSys if you are worried about speed
I havent tested anything other than Log_file, but everything should work OK, I am only not sure about the mcal stuff
This added to Log.php
--------
/**
* Returns the LOG constant from PEAR_LOG constant (only needed for win32)
*
* @param int $priority A LOG_* / PEAR_LOG_* integer constant.
*
* @return int The LOG_* integer constant
*/
function pearToSys($priority)
{
$priorities = array(
PEAR_LOG_EMERG => LOG_EMERG,
PEAR_LOG_ALERT => LOG_ALERT,
PEAR_LOG_CRIT => LOG_CRIT,
PEAR_LOG_ERR => LOG_ERR,
PEAR_LOG_WARNING => LOG_WARNING,
PEAR_LOG_NOTICE => LOG_NOTICE,
PEAR_LOG_INFO => LOG_INFO,
PEAR_LOG_DEBUG => LOG_DEBUG
);
return $priorities[$priority];
}