level < WARN mapped to E_USER_NOTICE
* - WARN <= level < ERROR mapped to E_USER_WARNING
* - level >= ERROR mapped to E_USER_ERROR
*
* An example:
*
* {@example ../../examples/php/appender_php.php 19}
*
* {@example ../../examples/resources/appender_php.properties 18}
*
* @version $Revision$
* @package log4php
* @subpackage appenders
*/
class LoggerAppenderPhp extends LoggerAppender {
public function append(LoggerLoggingEvent $event) {
if($this->layout !== null) {
$level = $event->getLevel();
if($level->isGreaterOrEqual(LoggerLevel::getLevelError())) {
trigger_error($this->layout->format($event), E_USER_ERROR);
} else if ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) {
trigger_error($this->layout->format($event), E_USER_WARNING);
} else {
trigger_error($this->layout->format($event), E_USER_NOTICE);
}
}
}
}