Skip to content

Commit

Permalink
Dev: allow to use Yii log system for tracevar even with debug=>0 (#812)
Browse files Browse the repository at this point in the history
Dev: with debug=>0 : log is not done (http://www.yiiframework.com/doc/api/1.1/YiiBase#trace-detail)
Dev: with log : we allow user to have their way to log
Dev: Just a shortcut, but quickest way to trace ;)
  • Loading branch information
Shnoulle committed Sep 21, 2017
1 parent 134cbef commit 0c65d09
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions application/helpers/globals.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ function App()
return Yii::app();
}


/**
* If debug = 2 in application/config.php this will produce output in the console / firebug
* similar to var_dump. It will also include the filename and line that called this method.
Expand All @@ -27,11 +26,8 @@ function traceVar($variable, $depth = 10) {
$msg = CVarDumper::dumpAsString($variable, $depth, false);
$fullTrace = debug_backtrace();
$trace=array_shift($fullTrace);
if(isset($trace['file'],$trace['line']) && strpos($trace['file'],YII_PATH)!==0)
{
if(isset($trace['file'],$trace['line']) && strpos($trace['file'],YII_PATH)!==0) {
$msg = $trace['file'].' ('.$trace['line']."):\n" . $msg;
}
Yii::trace($msg, 'vardump');
Yii::log($msg, 'trace', 'vardump');
}

?>

0 comments on commit 0c65d09

Please sign in to comment.