From fa64202a866b205909f16253fd5a9add1b299d1a Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Wed, 25 Sep 2013 23:53:19 +0100 Subject: [PATCH] MDL-41985 JavaScript: Add option to filter YUI logging statements --- config-dist.php | 18 ++++++++++++++++++ lib/outputrequirementslib.php | 11 +++++++++++ 2 files changed, 29 insertions(+) diff --git a/config-dist.php b/config-dist.php index e57a61dff9c..c5bf4bea840 100644 --- a/config-dist.php +++ b/config-dist.php @@ -489,6 +489,24 @@ $CFG->admin = 'admin'; // Prevent JS caching // $CFG->cachejs = false; // NOT FOR PRODUCTION SERVERS! // +// Restrict which YUI logging statements are shown in the browser console. +// For details see the upstream documentation: +// http://yuilibrary.com/yui/docs/api/classes/config.html#property_logInclude +// http://yuilibrary.com/yui/docs/api/classes/config.html#property_logExclude +// $CFG->yuiloginclude = array( +// 'moodle-core-dock-loader' => true, +// 'moodle-course-categoryexpander' => true, +// ); +// $CFG->yuilogexclude = array( +// 'moodle-core-dock' => true, +// 'moodle-core-notification' => true, +// ); +// +// Set the minimum log level for YUI logging statements. +// For details see the upstream documentation: +// http://yuilibrary.com/yui/docs/api/classes/config.html#property_logLevel +// $CFG->yuiloglevel = 'debug'; +// // Prevent core_string_manager application caching // $CFG->langstringcache = false; // NOT FOR PRODUCTION SERVERS! // diff --git a/lib/outputrequirementslib.php b/lib/outputrequirementslib.php index 0dbe7bbb985..7458a2e0785 100644 --- a/lib/outputrequirementslib.php +++ b/lib/outputrequirementslib.php @@ -249,6 +249,17 @@ class page_requirements_manager { $this->YUI_config->debug = false; } + // Include the YUI config log filters. + if (!empty($CFG->yuilogexclude) && is_array($CFG->yuilogexclude)) { + $this->YUI_config->logExclude = $CFG->yuilogexclude; + } + if (!empty($CFG->yuiloginclude) && is_array($CFG->yuiloginclude)) { + $this->YUI_config->logInclude = $CFG->yuiloginclude; + } + if (!empty($CFG->yuiloglevel)) { + $this->YUI_config->logLevel = $CFG->yuiloglevel; + } + // Add the moodle group's module data. $this->YUI_config->add_moodle_metadata();