function toScreen(Error $error)
    {
        extract($error->toArray());
        $frmt = formatter('<li>%s <em>in</em> %s</li>');
        $msg = date('H:i:s') . " {$component} {$signal} at {$place} - {$title}\n";
        $trace = join(array_map($frmt, format_trace($error->getTrace())));
        return <<<HTML
<style type="text/css">
.Debug { font-family:Calibri,Arial,sans-serif; border:1px solid #D86; padding:0 0 .7em .5em; margin:.5em 0 }
.Debug PRE { font-family:Consolas,Courier,monospace; margin:0; }
.Debug SMALL { color:#777; }
.Debug H1 { font-size:1.3em; margin:5px 0 0 0; color: #F75; }
.Debug H1 SMALL { font-size:.8em; color: #777; }
.Debug H1 SMALL STRONG { color: #000; }
.Debug H2 { font-size:1em; background-color:#EE9; margin:.5em 0 0 -8px; padding:.3em 10px; }
.Debug H3 { font-size:1em; margin:0 -8px; padding:0 10px .2em 10px; }
.Debug H4 { font-size:.9em; margin:7px 0 10px 1px; float:left; }
.Debug UL { font-size:1em; margin:5px 5px 0 0; padding-left:1.7em; list-style:none; }
</style>
<div class="Debug">
<h1>Unhandled exception
<small>at {$place}</small></h1>
<h2>{$msg}</h2>
<h4>Via:</h4>
<ul>{$trace}</ul>
</div>
HTML;
    }
Esempio n. 2
0
function apf_exception_handler($exception)
{
    $logger = APF::get_instance()->get_logger();
    $trace = format_trace($exception->getTrace());
    $trace = "exception '" . get_class($exception) . "' with message '" . $exception->getMessage() . "' in " . $exception->getFile() . ":" . $exception->getLine() . " Stack trace: " . $trace;
    $logger->warn("apf_exception_handler", $trace);
    return TRUE;
}
Esempio n. 3
0
/**
 * 记录程序异常
 * @param Exception $exception
 */
function mpf_exception_handler($exception)
{
    $logger = MPF::get_instance()->get_logger();
    $trace = format_trace($exception->getTrace());
    $trace = "exception '" . get_class($exception) . "' with message '" . $exception->getMessage() . "' in " . $exception->getFile() . ":" . $exception->getLine() . " Stack trace: " . $trace;
    //MPF::get_instance()->register_shutdown_function(array($logger, "warn"));
    $logger->warn("mpf_exception_handler", $trace);
    return TRUE;
}