Skip to content

Commit

Permalink
config.php: merge from trunk; suppress _debug write failures
Browse files Browse the repository at this point in the history
git-svn-id: https://xerteonlinetoolkits.googlecode.com/svn/branches/1.8@191 912cdd6b-5c7d-d5a7-a2ba-d0f0cdb91641
  • Loading branch information
Dave Goodwin committed Oct 25, 2011
1 parent 5cff0c1 commit ccaa387
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions config.php
Expand Up @@ -28,10 +28,19 @@
}

if(!function_exists('_debug')) {
function _debug($string) {
/**
* @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) {
global $development;
if(isset($development) && $development) {
file_put_contents('/tmp/debug.log', date('Y-m-d H:i:s ') . $string . "\n", FILE_APPEND);
// 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;
}
@file_put_contents('/tmp/debug.log', date('Y-m-d H:i:s ') . $string . "\n", FILE_APPEND);
}
}
}
Expand Down

0 comments on commit ccaa387

Please sign in to comment.