Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-41985

Add filtering options for YUI logging statements

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.6
    • Fix Version/s: 2.6
    • Component/s: JavaScript
    • Labels:
    • Testing Instructions:
      Hide
      1. open Moodle at the front page logged out, using a theme that supports docking
      2. ensure that you have no blocks docked
      3. open your browser's JS console
      4. refresh the page
      5. *Confirm: You see logs for moodle-core-dock-loader and moodle-block_navigation (note there may be others too if you have other YUI modules loaded)
      6. dock one of the blocks
        • Confirm that you see logs for moodle-core-dock
      7. Open your config.php and set:

        $CFG->yuiloginclude = array(
            'moodle-core-dock' => true,
        );
        

      8. refresh the page
        • Confirm: The only logs shown are for moodle-core-dock
      9. undock the block
      10. Edit your config.php again, remove the yuiloginclude and set:

        $CFG->yuilogexclude = array(
            'moodle-core-dock' => true,
        );
        

      11. refresh the page
        • Confirm: You see logs again for moodle-core-dock-loader, and moodle-block_navigation
      12. dock a block
        • Confirm: No logs are shown for moodle-core-dock
      13. undock the block
      14. Edit your config.php again, remove the yuilogexclude and set:

        $CFG->yuiloglevel = 'error';
        

      15. refresh the page
        • Confirm: No logs relating to moodle-core-dock-loader are shown
      16. in the console run:

        Y.log('example', 'error');
        

        • Confirm: That you saw your example message
      Show
      open Moodle at the front page logged out, using a theme that supports docking ensure that you have no blocks docked open your browser's JS console refresh the page *Confirm: You see logs for moodle-core-dock-loader and moodle-block_navigation (note there may be others too if you have other YUI modules loaded) dock one of the blocks Confirm that you see logs for moodle-core-dock Open your config.php and set: $CFG->yuiloginclude = array( 'moodle-core-dock' => true, ); refresh the page Confirm: The only logs shown are for moodle-core-dock undock the block Edit your config.php again, remove the yuiloginclude and set: $CFG->yuilogexclude = array( 'moodle-core-dock' => true, ); refresh the page Confirm: You see logs again for moodle-core-dock-loader, and moodle-block_navigation dock a block Confirm: No logs are shown for moodle-core-dock undock the block Edit your config.php again, remove the yuilogexclude and set: $CFG->yuiloglevel = 'error'; refresh the page Confirm: No logs relating to moodle-core-dock-loader are shown in the console run: Y.log('example', 'error'); Confirm: That you saw your example message
    • Affected Branches:
      MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE
    • Pull Master Branch:
      MDL-41985-master

      Description

      YUI's Y.log statement supports additional options which we can make use of to ease our debugging woes.

      See http://yuilibrary.com/yui/docs/api/classes/YUI.html#method_log:

      (msg, cat, src, silent)
      

      We can filter on the logLevel (

      1. debug
      2. info
      3. warn
      4. error

      See http://yuilibrary.com/yui/docs/api/classes/config.html#property_logLevel

      And we can exclude and include various statements by the src:

      YUI_config.logInclude = {
        'moodle-core-example': true
      };
      YUI_config.logExclude = {
        'moodle-core-example': true
      };
      

      See:

      We should then encourage people using Y.log in their code to add both priority and src so that the relevant log lines can be filtered at will.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dobedobedoh Andrew Nicols
              Reporter:
              dobedobedoh Andrew Nicols
              Peer reviewer:
              Petr Skoda
              Integrator:
              Dan Poltawski
              Tester:
              Mark Nelson
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                18/Nov/13