[ Index ]
 

Code source de vtiger CRM 5.0.2

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

title

Body

[fermer]

/log4php/ -> LoggerAppender.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   */
  18  
  19  /**
  20   * @ignore 
  21   */
  22  if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__));
  23   
  24  /**
  25   * Abstract class that defines output logs strategies.
  26   *
  27   * @author  VxR <vxr@vxr.it>
  28   * @version $Revision: 1.14 $
  29   * @package log4php
  30   * @abstract
  31   */
  32  class LoggerAppender {
  33  
  34      /**
  35       * Factory
  36       *
  37       * @param string $name appender name
  38       * @param string $class create an instance of this appender class
  39       * @return LoggerAppender
  40       */
  41      function factory($name, $class)
  42      {
  43          $class = basename($class);
  44          if (!empty($class)) {
  45              if (!class_exists($class)) 
  46                  @include_once(LOG4PHP_DIR . "/appenders/{$class}.php");
  47              if (class_exists($class))
  48                  return new $class($name);
  49          }
  50          return null;
  51      }
  52      
  53      /**
  54       * Singleton
  55       *
  56       * @param string $name appender name
  57       * @param string $class create or get a reference instance of this class
  58       * @return LoggerAppender 
  59       */
  60      function &singleton($name, $class = '')
  61      {
  62          static $instances;
  63          
  64          if (!empty($name)) {
  65              if (!isset($instances[$name])) {
  66                  if (!empty($class)) {
  67                      $appender = LoggerAppender::factory($name, $class);
  68                      if ($appender !== null) { 
  69                          $instances[$name] = $appender;
  70                          return $instances[$name];
  71                      }
  72                  }
  73                  return null;
  74              }
  75              return $instances[$name];                
  76          }        
  77          return null;        
  78      }
  79      
  80      /* --------------------------------------------------------------------------*/
  81      /* --------------------------------------------------------------------------*/
  82      /* --------------------------------------------------------------------------*/
  83      
  84      /**
  85       * Add a filter to the end of the filter list.
  86       *
  87       * @param LoggerFilter $newFilter add a new LoggerFilter
  88       * @abstract
  89       */
  90      function addFilter($newFilter)
  91      {
  92          // override 
  93      }
  94      
  95      /**
  96       * Clear the list of filters by removing all the filters in it.
  97       * @abstract
  98       */
  99      function clearFilters()
 100      {
 101          // override    
 102      }
 103  
 104      /**
 105       * Return the first filter in the filter chain for this Appender. 
 106       * The return value may be <i>null</i> if no is filter is set.
 107       * @return Filter
 108       */
 109      function &getFilter()
 110      {
 111          // override    
 112      } 
 113      
 114      /**
 115       * Release any resources allocated.
 116       * Subclasses of {@link LoggerAppender} should implement 
 117       * this method to perform proper closing procedures.
 118       * @abstract
 119       */
 120      function close()
 121      {
 122          //override me
 123      }
 124  
 125      /**
 126       * This method performs threshold checks and invokes filters before
 127       * delegating actual logging to the subclasses specific <i>append()</i> method.
 128       * @param LoggerLoggingEvent $event
 129       * @abstract
 130       */
 131      function doAppend($event)
 132      {
 133          //override me    
 134      }
 135  
 136      /**
 137       * Get the name of this appender.
 138       * @return string
 139       */
 140      function getName()
 141      {
 142          //override me    
 143      }
 144  
 145      /**
 146       * Do not use this method.
 147       *
 148       * @param object $errorHandler
 149       */
 150      function setErrorHandler($errorHandler)
 151      {
 152          // override me
 153      }
 154      
 155      /**
 156       * Do not use this method.
 157       * @return object Returns the ErrorHandler for this appender.
 158       */
 159      function &getErrorHandler()
 160      {
 161          return $this->errorHandler;
 162      } 
 163  
 164      /**
 165       * Set the Layout for this appender.
 166       *
 167       * @param LoggerLayout $layout
 168       */
 169      function setLayout($layout)
 170      {
 171          // override me
 172      }
 173      
 174      /**
 175       * Returns this appender layout.
 176       * @return LoggerLayout
 177       */
 178      function &getLayout()
 179      {
 180          // override me
 181      }
 182  
 183      /**
 184       * Set the name of this appender.
 185       *
 186       * The name is used by other components to identify this appender.
 187       *
 188       * @param string $name
 189       */
 190      function setName($name) 
 191      {
 192          // override me    
 193      }
 194  
 195      /**
 196       * Configurators call this method to determine if the appender
 197       * requires a layout. 
 198       *
 199       * <p>If this method returns <i>true</i>, meaning that layout is required, 
 200       * then the configurator will configure a layout using the configuration 
 201       * information at its disposal.  If this method returns <i>false</i>, 
 202       * meaning that a layout is not required, then layout configuration will be
 203       * skipped even if there is available layout configuration
 204       * information at the disposal of the configurator.</p>
 205       *
 206       * <p>In the rather exceptional case, where the appender
 207       * implementation admits a layout but can also work without it, then
 208       * the appender should return <i>true</i>.</p>
 209       *
 210       * @return boolean
 211       */
 212      function requiresLayout()
 213      {
 214          // override me
 215      }
 216  
 217  }
 218  ?>


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