<?php class Error { private function __construct( $eErrorNo, $eErrorStr, $eFile, $eLine, $eContext ) { echo '<table cellspacing="0" cellpadding="0" style="font-family: verdana; font-size: 10px; border: 1px solid #000000;"><tr><td>'; Plik: ' . $eFile . '<br /> Linia: ' . $eLine . '<br /> Tresc: ' . $eErrorStr; $eTxtLog = date('d.m.Y H:i:s') . '|*|' . $this->getError($eErrorNo) . '|*|' . $eFile . '|*|' . $eLine . '|*|' . $eErrorStr; $this->Add2Log( $eTxtLog ); } { { $class = __CLASS__; self::$instance = new $class($eErrorNo, $eErrorStr, $eFile, $eLine, $eContext); } return self::$instance; } private function Add2Log( $eTxtLog ) { $eTxtLog = $eTxtLog . "\r\n"; } private function getError( $eErrorNo ) { E_ERROR => 'Error', E_WARNING => 'Warning', E_PARSE => 'Parsing Error', E_NOTICE => 'Notice', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice' ); return $aErrors[$eErrorNo]; } } ?>
I jego wykorzystanie:
<?php ?>
Zalezy mi abyscie wskazali bledy, podsuneli pomysly, inne rozwiazania. Nie jestem pewien czy tak powinien wygladac Error Handler.