Skip to content
Permalink
Browse files

Tiny Improvement of debug() output when running on console

Signed-off-by: mark_story <mark@mark-story.com>
  • Loading branch information...
MSeven authored and markstory committed Jun 3, 2010
1 parent 1384827 commit cef99276049d3d2612b3d9a2e9998b86d28eedeb
Showing with 17 additions and 4 deletions.
  1. +17 −4 cake/basics.php
@@ -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')) {

0 comments on commit cef9927

Please sign in to comment.
You can’t perform that action at this time.