From c7b02d2063e96a8d0959e535c91cf1d0a07d1b5a Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 6 Feb 2012 23:04:42 +0100 Subject: [PATCH] MINOR Rewrite stack trace from "In line of " to a more readable and common ":" --- dev/Backtrace.php | 4 ++-- dev/Debug.php | 8 ++++---- dev/LogErrorEmailFormatter.php | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dev/Backtrace.php b/dev/Backtrace.php index 45531f70e..e147a99ee 100644 --- a/dev/Backtrace.php +++ b/dev/Backtrace.php @@ -163,7 +163,7 @@ class SS_Backtrace { foreach($bt as $item) { if($plainText) { $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"; } else { if ($item['function'] == 'user_error') { @@ -172,8 +172,8 @@ class SS_Backtrace { $name = self::full_func_name($item,true); } $result .= "
  • " . htmlentities($name, ENT_COMPAT, 'UTF-8') . "\n
    \n"; - $result .= isset($item['line']) ? "Line $item[line] of " : ''; $result .= isset($item['file']) ? htmlentities(basename($item['file']), ENT_COMPAT, 'UTF-8') : ''; + $result .= isset($item['line']) ? ":$item[line]" : ''; $result .= "
  • \n"; } } diff --git a/dev/Debug.php b/dev/Debug.php index 8c30fc9e0..2083c64e4 100644 --- a/dev/Debug.php +++ b/dev/Debug.php @@ -67,9 +67,9 @@ class Debug { if($showHeader) { $caller = Debug::caller(); 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 - echo "
    \n
    \n

    Debug ($caller[class]$caller[type]$caller[function]() \nin line $caller[line] \nof " . basename($caller['file']) . ")\n

    \n"; + echo "
    \n
    \n

    Debug ($caller[class]$caller[type]$caller[function]() \nin " . basename($caller['file']) . ":$caller[line])\n

    \n"; } echo Debug::text($val); @@ -88,7 +88,7 @@ class Debug { static function endshow($val) { if(!Director::isLive()) { $caller = Debug::caller(); - echo "
    \n

    Debug \n($caller[class]$caller[type]$caller[function]() \nin line $caller[line] \nof " . basename($caller['file']) . ")\n

    \n"; + echo "
    \n

    Debug \n($caller[class]$caller[type]$caller[function]() \nin " . basename($caller['file']) . ":$caller[line])\n

    \n"; echo Debug::text($val); die(); } @@ -102,7 +102,7 @@ class Debug { static function dump($val) { echo '
    ';
     		$caller = Debug::caller();
    -		echo "Line $caller[line] of " . basename($caller['file']) . ":\n";
    +		echo "" . basename($caller['file']) . ":$caller[line] - \n";
     		if (is_string($val)) print_r(wordwrap($val, 100));
     		else print_r($val);
     		echo '
    '; diff --git a/dev/LogErrorEmailFormatter.php b/dev/LogErrorEmailFormatter.php index df639e9f8..b9cae0c55 100644 --- a/dev/LogErrorEmailFormatter.php +++ b/dev/LogErrorEmailFormatter.php @@ -36,7 +36,7 @@ class SS_LogErrorEmailFormatter implements Zend_Log_Formatter_Interface { $errcontext = $event['message']['errcontext']; $data = "
    \n"; - $data .= "

    $errorType: $errstr
    At line $errline in $errfile\n
    \n
    \n

    \n"; + $data .= "

    [$errorType] $errstr
    $errfile:$errline\n
    \n
    \n

    \n"; // Get a backtrace, filtering out debug method calls $data .= SS_Backtrace::backtrace(true, false, array( @@ -52,7 +52,7 @@ class SS_LogErrorEmailFormatter implements Zend_Log_Formatter_Interface { $host = @$_SERVER['HTTP_HOST']; $uri = @$_SERVER['REQUEST_URI']; - $subject = "$errorType at $relfile line {$errline} (http://{$host}{$uri})"; + $subject = "[$errorType] in $relfile:{$errline} (http://{$host}{$uri})"; return array( 'subject' => $subject,