Re: Log: setMask
| From: | Sabine | Date: | Tue, 27 Jun 2006 16:27:09 +0000 |
| Subject: | Re: Log: setMask | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-24489@lists.php.net to get a copy of this message | ||
Hello Brian,
thanks for your answer. But that seems not to be the point. The problem persists.
Best regards
Sabine
brian schrieb:
Sabine wrote:Hello to all, I try to set a log-mask so that I only see emergency errors (for example). But I get all error messages. It must be very simple, but I don't see,what is wrong here: $colors = array( PEAR_LOG_CRIT => 'red'It should be: $logger =& Log::singleton( ... brian);$conf = array('title' => 'Test Logger','colors' => $colors ); $logger = &Log::singleton('win', 'TestLog', $_SERVER['PHP_SELF'], $conf);function phpErrorHandler($code, $message, $file, $line) { global $logger;/* Map the PHP error to a Log priority. */switch ($code) { case E_WARNING: case E_USER_WARNING:$priority = PEAR_LOG_WARNING; break;case E_NOTICE: case E_USER_NOTICE:$priority = PEAR_LOG_NOTICE; break;case E_ERROR: case E_USER_ERROR:$priority = PEAR_LOG_ERR; break;default:$priotity = PEAR_LOG_INFO;}$logger->log('PHP: ' . $message . ' in ' . $file . ' at line ' . $line, $priority);} set_error_handler('phpErrorHandler'); $mask = Log::MIN(PEAR_LOG_EMERG); $logger->setMask($mask); $logger->info("Test info"); $m = 1/0; That is, what I get:Ident Priority Message 00:39:51.42 /logger_test.php Notice PHP: Undefined offset: 6 in /usr/share/php/Log/win.php at line 246 00:39:51.42 /logger_test.php Info Test info 00:39:51.42 /logger_test.php Warning PHP: Division by zero in /logger_test.php at line 47