YUI 3.x Home -

YUI Library Examples: Console: Using the ConsoleFilters plugin

Note: This is YUI 3.x. Looking for YUI 2.x?

Console: Using the ConsoleFilters plugin

This example illustrates how to use and configure the ConsoleFilters plugin for Console. The debug versions of YUI module files are used, so standard YUI debugging messages are broadcast to the Console.

Use the checkboxes in the Console footer to control which messages are displayed or hidden. Click the "Log a message" button to call Y.log using a custom category and source.

Note how new filter checkboxes are added when a new category or source are received by the Console, for example when clicking on the "Log a message" button.

Configure the YUI instance for debug mode

Only the module-debug.js versions of module files include log statements, so we'll set up our YUI instance's filter property to "debug". We'll also reduce the noise somewhat by specifying a logInclude list.

Create the Console and plug in ConsoleFilters

All that's left to do now is plugin in the ConsoleFilters plugin. This can be done in one of a few ways.

Alternatively, you can attach the ConsoleFilters plugin after instantiation. This version also shows how to apply initial category and source filter states.

Full Code Listing

Markup

JavaScript

CSS

Copyright © 2009 Yahoo! Inc. All rights reserved.

Privacy Policy - Terms of Service - Copyright Policy - Job Openings