Skip to content

Commit

Permalink
MDL-25150 new debugusers setting
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Nov 11, 2010
1 parent 740952e commit 0ed26d1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions config-dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,11 @@
// $CFG->debug = 38911; // DEBUG_DEVELOPER // NOT FOR PRODUCTION SERVERS!
// $CFG->debugdisplay = true; // NOT FOR PRODUCTION SERVERS!
//
// You can specify a comma separated list of user ids that that always see
// debug messages, this overrides the debug flag in $CFG->debug and $CFG->debugdisplay
// for these users only.
// $CFG->debugusers = '2';
//
// Prevent theme caching
// $CFG->themerev = -1; // NOT FOR PRODUCTION SERVERS!
//
Expand Down
12 changes: 9 additions & 3 deletions lib/weblib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2843,9 +2843,15 @@ function get_docs_url($path) {
* @return bool
*/
function debugging($message = '', $level = DEBUG_NORMAL, $backtrace = null) {
global $CFG, $UNITTEST;
global $CFG, $USER, $UNITTEST;

if (empty($CFG->debug) || $CFG->debug < $level) {
$forcedebug = false;
if (!empty($CFG->debugusers)) {
$debugusers = explode(',', $CFG->debugusers);
$forcedebug = in_array($USER->id, $debugusers);
}

if (!$forcedebug and (empty($CFG->debug) || $CFG->debug < $level)) {
return false;
}

Expand All @@ -2871,7 +2877,7 @@ function debugging($message = '', $level = DEBUG_NORMAL, $backtrace = null) {
// we send the info to error log instead
error_log('Debugging: ' . $message . $from);

} else if ($CFG->debugdisplay) {
} else if ($forcedebug or $CFG->debugdisplay) {
if (!defined('DEBUGGING_PRINTED')) {
define('DEBUGGING_PRINTED', 1); // indicates we have printed something
}
Expand Down

0 comments on commit 0ed26d1

Please sign in to comment.