[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/log4php/spi/ -> LoggerFilter.php (source)

   1  <?php
   2  /**
   3   * log4php is a PHP port of the log4j java logging package.
   4   * 
   5   * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
   6   * <p>Design, strategies and part of the methods documentation are developed by log4j team 
   7   * (Ceki Gülcü as log4j project founder and 
   8   * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
   9   *
  10   * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
  11   * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
  12   *
  13   * <p>This software is published under the terms of the LGPL License
  14   * a copy of which has been included with this distribution in the LICENSE file.</p>
  15   * 
  16   * @package log4php
  17   * @subpackage spi
  18   */
  19  
  20  /**
  21   * @ignore 
  22   */
  23  if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
  24   
  25  /**
  26   * The log event must be logged immediately without consulting with
  27   * the remaining filters, if any, in the chain.  
  28   */
  29  define('LOG4PHP_LOGGER_FILTER_ACCEPT',  1);
  30  
  31  /**
  32   * This filter is neutral with respect to the log event. The
  33   * remaining filters, if any, should be consulted for a final decision.
  34   */
  35  define('LOG4PHP_LOGGER_FILTER_NEUTRAL', 0);
  36  
  37  /**
  38   * The log event must be dropped immediately without consulting
  39   *  with the remaining filters, if any, in the chain.  
  40   */
  41  define('LOG4PHP_LOGGER_FILTER_DENY',    -1);
  42  
  43  /**
  44   * Users should extend this class to implement customized logging
  45   * event filtering. Note that {@link LoggerCategory} and {@link LoggerAppenderSkeleton}, 
  46   * the parent class of all standard
  47   * appenders, have built-in filtering rules. It is suggested that you
  48   * first use and understand the built-in rules before rushing to write
  49   * your own custom filters.
  50   * 
  51   * <p>This abstract class assumes and also imposes that filters be
  52   * organized in a linear chain. The {@link #decide
  53   * decide(LoggerLoggingEvent)} method of each filter is called sequentially,
  54   * in the order of their addition to the chain.
  55   * 
  56   * <p>The {@link decide()} method must return one
  57   * of the integer constants {@link LOG4PHP_LOG4PHP_LOGGER_FILTER_DENY}, 
  58   * {@link LOG4PHP_LOGGER_FILTER_NEUTRAL} or {@link LOG4PHP_LOGGER_FILTER_ACCEPT}.
  59   * 
  60   * <p>If the value {@link LOG4PHP_LOGGER_FILTER_DENY} is returned, then the log event is
  61   * dropped immediately without consulting with the remaining
  62   * filters. 
  63   * 
  64   * <p>If the value {@link LOG4PHP_LOGGER_FILTER_NEUTRAL} is returned, then the next filter
  65   * in the chain is consulted. If there are no more filters in the
  66   * chain, then the log event is logged. Thus, in the presence of no
  67   * filters, the default behaviour is to log all logging events.
  68   * 
  69   * <p>If the value {@link LOG4PHP_LOGGER_FILTER_ACCEPT} is returned, then the log
  70   * event is logged without consulting the remaining filters. 
  71   * 
  72   * <p>The philosophy of log4php filters is largely inspired from the
  73   * Linux ipchains. 
  74   * 
  75   * @author VxR <vxr@vxr.it>
  76   * @version $Revision: 1.4 $
  77   * @package log4php
  78   * @subpackage spi
  79   */
  80  class LoggerFilter {
  81  
  82      /**
  83       * @var LoggerFilter Points to the next {@link LoggerFilter} in the filter chain.
  84       */
  85      var $next;
  86  
  87      /**
  88       * Usually filters options become active when set. We provide a
  89       * default do-nothing implementation for convenience.
  90      */
  91      function activateOptions()
  92      {
  93          return;
  94      }
  95  
  96      /**   
  97       * Decide what to do.  
  98       * <p>If the decision is {@link LOG4PHP_LOGGER_FILTER_DENY}, then the event will be
  99       * dropped. If the decision is {@link LOG4PHP_LOGGER_FILTER_NEUTRAL}, then the next
 100       * filter, if any, will be invoked. If the decision is {@link LOG4PHP_LOGGER_FILTER_ACCEPT} then
 101       * the event will be logged without consulting with other filters in
 102       * the chain.
 103       *
 104       * @param LoggerLoggingEvent $event The {@link LoggerLoggingEvent} to decide upon.
 105       * @return integer {@link LOG4PHP_LOGGER_FILTER_NEUTRAL} or {@link LOG4PHP_LOGGER_FILTER_DENY}|{@link LOG4PHP_LOGGER_FILTER_ACCEPT}
 106       */
 107      function decide($event)
 108      {
 109          return LOG4PHP_LOGGER_FILTER_NEUTRAL;
 110      }
 111  
 112  }
 113  ?>


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7