[ Index ]
 

Code source de SPIP Agora 1.4

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

title

Body

[fermer]

/Pear/Log/ -> null.php (source)

   1  <?php
   2  /**
   3   * $Header: /repository/pear/Log/Log/null.php,v 1.3 2004/01/19 08:02:40 jon Exp $
   4   *
   5   * @version $Revision: 1.3 $
   6   * @package Log
   7   */
   8  
   9  /**
  10   * The Log_null class is a concrete implementation of the Log:: abstract
  11   * class.  It simply consumes log events.
  12   * 
  13   * @author  Jon Parise <jon@php.net>
  14   * @since   Log 1.8.2
  15   * @package Log
  16   *
  17   * @example null.php    Using the null handler.
  18   */
  19  class Log_null extends Log
  20  {
  21      /**
  22       * Constructs a new Log_null object.
  23       * 
  24       * @param string $name     Ignored.
  25       * @param string $ident    The identity string.
  26       * @param array  $conf     The configuration array.
  27       * @param int    $level    Log messages up to and including this level.
  28       * @access public
  29       */
  30      function Log_null($name, $ident = '', $conf = array(),
  31                        $level = PEAR_LOG_DEBUG)
  32      {
  33          $this->_id = md5(microtime());
  34          $this->_ident = $ident;
  35          $this->_mask = Log::UPTO($level);
  36      }
  37  
  38      /**
  39       * Simply consumes the log event.  The message will still be passed
  40       * along to any Log_observer instances that are observing this Log.
  41       * 
  42       * @param mixed  $message    String or object containing the message to log.
  43       * @param string $priority The priority of the message.  Valid
  44       *                  values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,
  45       *                  PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,
  46       *                  PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.
  47       * @return boolean  True on success or false on failure.
  48       * @access public
  49       */
  50      function log($message, $priority = null)
  51      {
  52          /* If a priority hasn't been specified, use the default value. */
  53          if ($priority === null) {
  54              $priority = $this->_priority;
  55          }
  56  
  57          /* Abort early if the priority is above the maximum logging level. */
  58          if (!$this->_isMasked($priority)) {
  59              return false;
  60          }
  61  
  62          $this->_announce(array('priority' => $priority, 'message' => $message));
  63  
  64          return true;
  65      }
  66  }
  67  
  68  ?>


Généré le : Sat Feb 24 14:40:03 2007 par Balluche grâce à PHPXref 0.7