Skip to content

Commit

Permalink
Allow non-string like things to go into _debug (print_r them).
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidGoodwin committed May 2, 2014
1 parent 5d997ad commit d28f57c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
* @param string $string - the message to write to the debug file.
* @param int $up - how far up the call stack we go to; this affects the line number/file name given in logging
*/
function _debug($string, $up = 0)
{
function _debug($string, $up = 0) {
global $development;
if (isset($development) && $development) {
if (!is_string($string)) {
$string = print_r($string, true);
}

// yes, we really don't want to report file write errors if this doesn't work.

$backtrace = debug_backtrace();
if (isset($backtrace[$up]['file'])) {
$string = $backtrace[$up]['file'] . $backtrace[$up]['line'] . $string;
Expand Down

0 comments on commit d28f57c

Please sign in to comment.