[ Index ]
 

Code source de SPIP Agora 1.4

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

title

Body

[fermer]

/Pear/docs/examples/ -> php_error_handler.php (source)

   1  <?php
   2  
   3  require_once 'Log.php';
   4  
   5  function errorHandler($code, $message, $file, $line)
   6  {
   7      global $logger;
   8  
   9      /* Map the PHP error to a Log priority. */
  10      switch ($code) {
  11      case E_WARNING:
  12      case E_USER_WARNING:
  13          $priority = PEAR_LOG_WARNING;
  14          break;
  15      case E_NOTICE:
  16      case E_USER_NOTICE:
  17          $priority = PEAR_LOG_NOTICE;
  18          break;
  19      case E_ERROR:
  20      case E_USER_ERROR:
  21          $priority = PEAR_LOG_ERR;
  22          break;
  23      default:
  24          $priotity = PEAR_LOG_INFO;
  25      }
  26  
  27      $logger->log($message . ' in ' . $file . ' at line ' . $line,
  28                   $priority);
  29  }
  30  
  31  $logger = &Log::singleton('console', '', 'ident');
  32  
  33  set_error_handler('errorHandler');
  34  trigger_error('This is an information log message.', E_USER_NOTICE);


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