Skip to content

Commit

Permalink
Tiny Improvement of debug() output when running on console
Browse files Browse the repository at this point in the history
Signed-off-by: mark_story <mark@mark-story.com>
  • Loading branch information
MSeven authored and markstory committed Oct 24, 2010
1 parent 1384827 commit cef9927
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions cake/basics.php
Expand Up @@ -94,16 +94,29 @@ function debug($var = false, $showHtml = false, $showFrom = true) {
if (Configure::read('debug') > 0) {
if ($showFrom) {
$calledFrom = debug_backtrace();
echo '<strong>' . substr(str_replace(ROOT, '', $calledFrom[0]['file']), 1) . '</strong>';
echo ' (line <strong>' . $calledFrom[0]['line'] . '</strong>)';
if(defined('CAKEPHP_SHELL')){
echo "##########DEBUG##########\n";
echo substr(str_replace(ROOT, '', $calledFrom[0]['file']), 1) ;
echo ' (line ' . $calledFrom[0]['line'] . ')'."\n";
}else{
echo '<strong>' . substr(str_replace(ROOT, '', $calledFrom[0]['file']), 1) . '</strong>';
echo ' (line <strong>' . $calledFrom[0]['line'] . '</strong>)';
}
}
if(!defined('CAKEPHP_SHELL')){
echo "\n<pre class=\"cake-debug\">\n";
}
echo "\n<pre class=\"cake-debug\">\n";

$var = print_r($var, true);
if ($showHtml) {
$var = str_replace('<', '&lt;', str_replace('>', '&gt;', $var));
}
echo $var . "\n</pre>\n";
echo $var . "\n";
if(!defined('CAKEPHP_SHELL')){
echo "<pre class=\"cake-debug\">\n";
}else{
echo "#########################\n";
};
}
}
if (!function_exists('sortByKey')) {
Expand Down

0 comments on commit cef9927

Please sign in to comment.