Re: How can i hightlight an stacktrace error/exception?
| From: | Jochem Maas | Date: | Wed, 03 Jan 2007 14:55:01 +0000 |
| Subject: | Re: How can i hightlight an stacktrace error/exception? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-246458@lists.php.net to get a copy of this message | ||
Mathijs wrote:
> Hello there,
>
> Is there a way to color exceptions/errors?
I recommend a combination of php & html (maybe with some css and
javascript thrown in for good measure)
e.g. (ripped straight from zend.com):
<?php
function printException(Exception $e) {
print "<h1>".get_class($e)."</h1>\n";
print "<h2>{$e->getMessage()}
({$e->getCode()})</h2>\n\n";
print "file: {$e->getFile()}<br />\n";
print "line: {$e->getLine()}<br />\n";
print $e->getTraceAsString();
}
?>
STFW if you want something more sophisticated.
> I try d to use highlight_string() but that only works on PHP code.
>
> Does someone has a function or something which can do this?
>
> Thx in advance.
>