<?php
/**
* Custom event handler.
* This class will accept only high leveled events.
*
* @author Marius Zadara <marius@zadara.org>
* @category org.zadara.marius.logger.classes.handlers
* @copyright (C) 2008 Marius Zadara <marius@zadara.org>
* @license GNU GPL
* @package org.zadara.marius.logger
* @final
*/
final class HighEventLevelHandler extends EventHandler
{
/**
* Default class constructor.
*
* @param String $uniqueId The handler's unique id - accepts null (in this case will be generated a random one)
* @return AllEventsHandler
*/
public function HighEventLevelHandler($uniqueId = null)
{
// init the parent
parent::EventHandler($uniqueId);
}
/**
* Custom implementation of the event acceptance function.
* Only events with high levels will be accepted
*
* @param Event $event The new event
* @return true
*/
public function isEventAccepted($event)
{
// accept only event with high levels
return in_array($event->getLevel(), array(Levels::$WARNING, Levels::$ERROR, Levels::$SEVERE, Levels::$CRITICAL, Levels::$CRASH));
}
}
?>
|