mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Rewrite stack trace from "In line <line> of <file>" to a more readable and common "<file>:<line>"
This commit is contained in:
parent
5ad2eea0e6
commit
c7b02d2063
@ -163,7 +163,7 @@ class SS_Backtrace {
|
|||||||
foreach($bt as $item) {
|
foreach($bt as $item) {
|
||||||
if($plainText) {
|
if($plainText) {
|
||||||
$result .= self::full_func_name($item,true) . "\n";
|
$result .= self::full_func_name($item,true) . "\n";
|
||||||
if(isset($item['line']) && isset($item['file'])) $result .= "line $item[line] of " . basename($item['file']) . "\n";
|
if(isset($item['line']) && isset($item['file'])) $result .= basename($item['file']) . ":$item[line]\n";
|
||||||
$result .= "\n";
|
$result .= "\n";
|
||||||
} else {
|
} else {
|
||||||
if ($item['function'] == 'user_error') {
|
if ($item['function'] == 'user_error') {
|
||||||
@ -172,8 +172,8 @@ class SS_Backtrace {
|
|||||||
$name = self::full_func_name($item,true);
|
$name = self::full_func_name($item,true);
|
||||||
}
|
}
|
||||||
$result .= "<li><b>" . htmlentities($name, ENT_COMPAT, 'UTF-8') . "</b>\n<br />\n";
|
$result .= "<li><b>" . htmlentities($name, ENT_COMPAT, 'UTF-8') . "</b>\n<br />\n";
|
||||||
$result .= isset($item['line']) ? "Line $item[line] of " : '';
|
|
||||||
$result .= isset($item['file']) ? htmlentities(basename($item['file']), ENT_COMPAT, 'UTF-8') : '';
|
$result .= isset($item['file']) ? htmlentities(basename($item['file']), ENT_COMPAT, 'UTF-8') : '';
|
||||||
|
$result .= isset($item['line']) ? ":$item[line]" : '';
|
||||||
$result .= "</li>\n";
|
$result .= "</li>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,9 +67,9 @@ class Debug {
|
|||||||
if($showHeader) {
|
if($showHeader) {
|
||||||
$caller = Debug::caller();
|
$caller = Debug::caller();
|
||||||
if(Director::is_ajax() || Director::is_cli())
|
if(Director::is_ajax() || Director::is_cli())
|
||||||
echo "Debug ($caller[class]$caller[type]$caller[function]() in line $caller[line] of " . basename($caller['file']) . ")\n";
|
echo "Debug ($caller[class]$caller[type]$caller[function]() in " . basename($caller['file']) . ":$caller[line])\n";
|
||||||
else
|
else
|
||||||
echo "<div style=\"background-color: white; text-align: left;\">\n<hr>\n<h3>Debug <span style=\"font-size: 65%\">($caller[class]$caller[type]$caller[function]() \n<span style=\"font-weight:normal\">in line</span> $caller[line] \n<span style=\"font-weight:normal\">of</span> " . basename($caller['file']) . ")</span>\n</h3>\n";
|
echo "<div style=\"background-color: white; text-align: left;\">\n<hr>\n<h3>Debug <span style=\"font-size: 65%\">($caller[class]$caller[type]$caller[function]() \nin " . basename($caller['file']) . ":$caller[line])</span>\n</h3>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo Debug::text($val);
|
echo Debug::text($val);
|
||||||
@ -88,7 +88,7 @@ class Debug {
|
|||||||
static function endshow($val) {
|
static function endshow($val) {
|
||||||
if(!Director::isLive()) {
|
if(!Director::isLive()) {
|
||||||
$caller = Debug::caller();
|
$caller = Debug::caller();
|
||||||
echo "<hr>\n<h3>Debug \n<span style=\"font-size: 65%\">($caller[class]$caller[type]$caller[function]() \n<span style=\"font-weight:normal\">in line</span> $caller[line] \n<span style=\"font-weight:normal\">of</span> " . basename($caller['file']) . ")</span>\n</h3>\n";
|
echo "<hr>\n<h3>Debug \n<span style=\"font-size: 65%\">($caller[class]$caller[type]$caller[function]() \nin " . basename($caller['file']) . ":$caller[line])</span>\n</h3>\n";
|
||||||
echo Debug::text($val);
|
echo Debug::text($val);
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
@ -102,7 +102,7 @@ class Debug {
|
|||||||
static function dump($val) {
|
static function dump($val) {
|
||||||
echo '<pre style="background-color:#ccc;padding:5px;font-size:14px;line-height:18px;">';
|
echo '<pre style="background-color:#ccc;padding:5px;font-size:14px;line-height:18px;">';
|
||||||
$caller = Debug::caller();
|
$caller = Debug::caller();
|
||||||
echo "<span style=\"font-size: 12px;color:#666;\">Line $caller[line] of " . basename($caller['file']) . ":</span>\n";
|
echo "<span style=\"font-size: 12px;color:#666;\">" . basename($caller['file']) . ":$caller[line] - </span>\n";
|
||||||
if (is_string($val)) print_r(wordwrap($val, 100));
|
if (is_string($val)) print_r(wordwrap($val, 100));
|
||||||
else print_r($val);
|
else print_r($val);
|
||||||
echo '</pre>';
|
echo '</pre>';
|
||||||
|
@ -36,7 +36,7 @@ class SS_LogErrorEmailFormatter implements Zend_Log_Formatter_Interface {
|
|||||||
$errcontext = $event['message']['errcontext'];
|
$errcontext = $event['message']['errcontext'];
|
||||||
|
|
||||||
$data = "<div style=\"border: 5px $colour solid\">\n";
|
$data = "<div style=\"border: 5px $colour solid\">\n";
|
||||||
$data .= "<p style=\"color: white; background-color: $colour; margin: 0\">$errorType: $errstr<br /> At line $errline in $errfile\n<br />\n<br />\n</p>\n";
|
$data .= "<p style=\"color: white; background-color: $colour; margin: 0\">[$errorType] $errstr<br />$errfile:$errline\n<br />\n<br />\n</p>\n";
|
||||||
|
|
||||||
// Get a backtrace, filtering out debug method calls
|
// Get a backtrace, filtering out debug method calls
|
||||||
$data .= SS_Backtrace::backtrace(true, false, array(
|
$data .= SS_Backtrace::backtrace(true, false, array(
|
||||||
@ -52,7 +52,7 @@ class SS_LogErrorEmailFormatter implements Zend_Log_Formatter_Interface {
|
|||||||
$host = @$_SERVER['HTTP_HOST'];
|
$host = @$_SERVER['HTTP_HOST'];
|
||||||
$uri = @$_SERVER['REQUEST_URI'];
|
$uri = @$_SERVER['REQUEST_URI'];
|
||||||
|
|
||||||
$subject = "$errorType at $relfile line {$errline} (http://{$host}{$uri})";
|
$subject = "[$errorType] in $relfile:{$errline} (http://{$host}{$uri})";
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'subject' => $subject,
|
'subject' => $subject,
|
||||||
|
Loading…
Reference in New Issue
Block a user