PHP Classes

File: _classes/_handlers/HighEventLevelHandler.class.php

Recommend this page to a friend!
  Classes of Marius Zadara   Logger   _classes/_handlers/HighEventLevelHandler.class.php   Download  
File: _classes/_handlers/HighEventLevelHandler.class.php
Role: Class source
Content type: text/plain
Description: Handler to accept only high level
Class: Logger
Filter and export data of application events
Author: By
Last change:
Date: 16 years ago
Size: 1,140 bytes
 

Contents

Class file image Download
<?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));
    }
}


?>