[ Index ]
 

Code source de vtiger CRM 5.0.2

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

title

Body

[fermer]

/log4php/ -> LoggerLog.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   * Helper class for internal logging
  26   *
  27   * <p>It uses php {@link PHP_MANUAL#trigger_error trigger_error()} function
  28   * to output messages.</p>
  29   * <p>You need to recode methods to output messages in a different way.</p> 
  30   *
  31   * @author VxR <vxr@vxr.it>
  32   * @version $Revision: 1.9 $
  33   * @package log4php
  34   */
  35  class LoggerLog {
  36  
  37      /**
  38       * Log if debug is enabled.
  39       *
  40       * Log using php {@link PHP_MANUAL#trigger_error trigger_error()} function 
  41       * with E_USER_NOTICE level by default.
  42       *
  43       * @param string $message log message
  44       * @param integer $errLevel level to log
  45       * @static
  46       */
  47      function log($message, $errLevel = E_USER_NOTICE)
  48      {
  49          if (LoggerLog::internalDebugging())
  50              trigger_error($message, $errLevel);
  51      }
  52      
  53      function internalDebugging($value = null)
  54      {
  55          static $debug = false;
  56  
  57          if (is_bool($value))
  58              $debug = $value;
  59          return $debug;
  60      }
  61      
  62      /**
  63       * Report a debug message. 
  64       *
  65       * @param string $message log message
  66       * @static
  67       * @since 0.3
  68       */
  69      function debug($message)
  70      {
  71          LoggerLog::log($message, E_USER_NOTICE);
  72      }
  73      
  74      /**
  75       * Report an error message. 
  76       *
  77       * @param string $message log message
  78       * @static
  79       * @since 0.3
  80       */
  81      function error($message)
  82      {
  83          trigger_error($message, E_USER_ERROR);
  84      }
  85      
  86      /**
  87       * Report a warning message. 
  88       *
  89       * @param string $message log message
  90       * @static
  91       * @since 0.3
  92       */
  93      function warn($message)
  94      {
  95          trigger_error($message, E_USER_WARNING);
  96      }
  97  
  98  }
  99  ?>


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