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

Add filtering options for YUI logging statements

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.6
    • 2.6
    • JavaScript
    • MOODLE_26_STABLE
    • MOODLE_26_STABLE
    • MDL-41985-master
    • 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

      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.

            dobedobedoh Andrew Lyons
            dobedobedoh Andrew Lyons
            Petr Skoda Petr Skoda
            Dan Poltawski Dan Poltawski
            Mark Nelson Mark Nelson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.