Skip to content

Instantly share code, notes, and snippets.

@meotimdihia
Created April 27, 2012 00:40
Show Gist options
  • Save meotimdihia/2504656 to your computer and use it in GitHub Desktop.
Save meotimdihia/2504656 to your computer and use it in GitHub Desktop.
protected function _getStackTrace(Exception $e) {
$trace = $e->getTrace();
$out = array();
foreach ($trace as $frame) {
if (isset($frame['file']) && isset($frame['line'])) {
if (strpos($frame['file'], 'app') !== false){
$basename = '<span style = "color: green;text-transform:none;font-size:12px">' . basename($frame['file']) . '</span>';
}else{
$basename = basename($frame['file']);
}
$dirname = dirname($frame['file']);
$out[] = '<div style = "margin:0">' . '<div style = "width:240px;margin:0;float:left;">' . $basename . '</div>' . $dirname . ', line ' . $frame['line'] . '</div>';
} elseif (isset($frame['class']) && isset($frame['function'])) {
$out[] = '<div style = "color:#C92434;margin:0;text-transform:none;font-size:12px">' . $frame['class'] . '::' . $frame['function'] . '</div>';
} else {
$out[] = '<div style = "color:#C92434;margin:0;text-transform:none;font-size:12px">' . '[internal]' . '</div>';
}
}
return implode('', $out);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment