source: branches/1.2/workflow/inc/log/examples/php_error_handler.php @ 1349

Revision 1349, 768 bytes checked in by niltonneto, 15 years ago (diff)

Ticket #561 - Inclusão do módulo Workflow faltante nessa versão.

  • Property svn:executable set to *
Line 
1<?php
2
3require_once 'Log.php';
4
5function 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
33set_error_handler('errorHandler');
34trigger_error('This is an information log message.', E_USER_NOTICE);
Note: See TracBrowser for help on using the repository browser.