console.js revision 9327ef7ad1fee11b0e494b97cc07386565326c03
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * A user interface for viewing log messages.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @module console
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovichvar getCN = Y.ClassNameManager.getClassName,
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich C_PAUSE_LABEL = getCN(CONSOLE,PAUSE,'label'),
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich C_ENTRY_META = getCN(CONSOLE,ENTRY,'meta'),
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich C_ENTRY_TIME = getCN(CONSOLE,ENTRY,'time'),
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich C_ENTRY_CONTENT = getCN(CONSOLE,ENTRY,'content'),
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich C_CONSOLE_CONTROLS = getCN(CONSOLE,'controls'),
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * Console creates a visualization for messages logged through calls to a YUI
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * instance's <code>Y.log( message, category, source )</code> method. The
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * debug versions of YUI modules will include logging statements to offer some
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * insight into the steps executed during that module's operation. Including
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * log statements in your code will cause those messages to also appear in the
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Console. Use Console to aid in developing your page or application.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Entry categories are also referred to as the log level, and entries are
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * filtered against the configured logLevel.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @class Console
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @extends Widget
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich Console.superclass.constructor.apply(this,arguments);
9b1ad7c4722db362bee7d39c851c94ba95f118b8Allen Rabinovich * The identity of the widget.
9b1ad7c4722db362bee7d39c851c94ba95f118b8Allen Rabinovich * @property Console.NAME
9b1ad7c4722db362bee7d39c851c94ba95f118b8Allen Rabinovich * @type String
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Static identifier for logLevel configuration setting to allow all
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * incoming messages to generate Console entries.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @property Console.LOG_LEVEL_INFO
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @type Number
9b1ad7c4722db362bee7d39c851c94ba95f118b8Allen Rabinovich * Static identifier for logLevel configuration setting to allow only
9b1ad7c4722db362bee7d39c851c94ba95f118b8Allen Rabinovich * incoming messages of logLevel "warn" or "error"
9b1ad7c4722db362bee7d39c851c94ba95f118b8Allen Rabinovich * to generate Console entries.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @property Console.LOG_LEVEL_WARN
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @type Number
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Static identifier for logLevel configuration setting to allow only
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * incoming messages of logLevel "error" to generate
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Console entries.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @property Console.LOG_LEVEL_ERROR
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @type Number
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Map (object) of classNames used to populate the placeholders in the
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Console.ENTRY_TEMPLATE markup when rendering a new Console entry.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * <p>By default, the keys contained in the object are:</p>
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * <li>entry_class</li>
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * <li>entry_meta_class</li>
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * <li>entry_cat_class</li>
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich * <li>entry_src_class</li>
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich * <li>entry_time_class</li>
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich * <li>entry_content_class</li>
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @property Console.ENTRY_CLASSES
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @type Object
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Map (object) of classNames used to populate the placeholders in the
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Console.HEADER_TEMPLATE, Console.BODY_TEMPLATE, and
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Console.FOOTER_TEMPLATE markup when rendering the Console UI.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * <p>By default, the keys contained in the object are:</p>
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * <li>console_hd_class</li>
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * <li>console_bd_class</li>
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * <li>console_ft_class</li>
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * <li>console_controls_class</li>
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * <li>console_checkbox_class</li>
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * <li>console_pause_class</li>
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * <li>console_pause_label_class</li>
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * <li>console_button_class</li>
a9a4fee30864f00049b02201b1af50ada7f769e3Allen Rabinovich * <li>console_clear_class</li>
a9a4fee30864f00049b02201b1af50ada7f769e3Allen Rabinovich * <li>console_title_class</li>
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @property Console.CHROME_CLASSES
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @type Object
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich console_controls_class : C_CONSOLE_CONTROLS,
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Markup template used to generate the DOM structure for the header
70837a7c5871ea73a84ab67d8c34fcd9d2daa31cAllen Rabinovich * section of the Console when it is rendered. The template includes
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * these {placeholder}s:
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * <li>console_hd_class - contributed by Console.CHROME_CLASSES</li>
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * <li>console_title_class - contributed by Console.CHROME_CLASSES</li>
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * <li>str_title - pulled from attribute strings.title</li>
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @property Console.HEADER_TEMPLATE
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @type String
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich '<div class="{console_hd_class}">'+
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich '<h4 class="{console_title_class}">{str_title}</h4>'+
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Markup template used to generate the DOM structure for the Console body
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * (where the messages are inserted) when it is rendered. The template
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich * includes only the {placeholder} "console_bd_class", which is
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich * constributed by Console.CHROME_CLASSES.
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich * @property Console.BODY_TEMPLATE
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich * @type String
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich BODY_TEMPLATE : '<div class="{console_bd_class}"></div>',
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich * Markup template used to generate the DOM structure for the footer
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich * section of the Console when it is rendered. The template includes
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * many of the {placeholder}s from Console.CHROME_CLASSES as well as:
a9a4fee30864f00049b02201b1af50ada7f769e3Allen Rabinovich * <li>id_guid - generated unique id, relates the label and checkbox</li>
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich * <li>str_pause - pulled from attribute strings.pause</li>
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * <li>str_clear - pulled from attribute strings.clear</li>
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @property Console.HEADER_TEMPLATE
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @type String
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich '<div class="{console_ft_class}">'+
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich '<div class="{console_controls_class}">'+
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich '<input type="checkbox" class="{console_checkbox_class} '+
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich '{console_pause_class}" value="1" id="{id_guid}"> '+
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich '<label for="{id_guid}" class="{console_pause_label_class}">'+
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich '{str_pause}</label>' +
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich '<input type="button" class="'+
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich '{console_button_class} {console_clear_class}" '+
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich 'value="{str_clear}">'+
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich * Default markup template used to create the DOM structure for Console
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * entries. The markup contains {placeholder}s for content and classes
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * that are replaced via Y.substitute. The default template contains
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * the {placeholder}s identified in Console.ENTRY_CLASSES as well as the
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * following placeholders that will be populated by the log entry data:
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * <li>cat_class</li>
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * <li>src_class</li>
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * <li>label</li>
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * <li>totalTime</li>
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * <li>elapsedTime</li>
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * <li>localTime</li>
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * <li>sourceAndDetail</li>
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * <li>message</li>
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * @property Console.ENTRY_TEMPLATE
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * @type String
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich '<pre class="{entry_class} {cat_class} {src_class}">'+
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich '<div class="{entry_meta_class}">'+
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich '<span class="{entry_cat_class}">'+
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich '{label}</span>'+
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich '<span class="{entry_time_class}">'+
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich ' {totalTime}ms (+{elapsedTime}) {localTime}:'+
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich '<p class="{entry_src_class}">'+
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich '{sourceAndDetail}'+
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich '<p class="{entry_content_class}">{message}</p>'+
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * Static property used to define the default attribute configuration of
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * the Widget.
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * @property Console.ATTRS
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * @Type Object
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * Name of the custom event that will communicate log messages.
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * @attribute logEvent
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * @type String
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * @default "yui:log"
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * Collection of strings used to label elements in the Console UI.
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * Default collection contains the following name:value pairs:
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * <li>title : "Log Console"</li>
a9a4fee30864f00049b02201b1af50ada7f769e3Allen Rabinovich * <li>pause : "Pause"</li>
a9a4fee30864f00049b02201b1af50ada7f769e3Allen Rabinovich * <li>clear : "Clear"</li>
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * @attribute strings
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * @type Object
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich * Boolean to pause the outputting of new messages to the console.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * When paused, messages will accumulate in the buffer.
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich * @attribute paused
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @type boolean
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @default false
9b1ad7c4722db362bee7d39c851c94ba95f118b8Allen Rabinovich * If a category is not specified in the Y.log(..) statement, this
9b1ad7c4722db362bee7d39c851c94ba95f118b8Allen Rabinovich * category will be used. Category is also called "log level".
9b1ad7c4722db362bee7d39c851c94ba95f118b8Allen Rabinovich * @attribute defaultCategory
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @type String
9b1ad7c4722db362bee7d39c851c94ba95f118b8Allen Rabinovich * @default "info"
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * If a source is not specified in the Y.log(..) statement, this
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich * source will be used.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @attribute defaultSource
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich * @type String
9b1ad7c4722db362bee7d39c851c94ba95f118b8Allen Rabinovich * @default "global"
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Markup template used to create the DOM structure for Console entries.
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich * @attribute entryTemplate
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @type String
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich * @default (see Console.ENTRY_TEMPLATE)
9b1ad7c4722db362bee7d39c851c94ba95f118b8Allen Rabinovich * Minimum entry log level to render into the Console. The initial
9b1ad7c4722db362bee7d39c851c94ba95f118b8Allen Rabinovich * logLevel value for all Console instances defaults from the
9b1ad7c4722db362bee7d39c851c94ba95f118b8Allen Rabinovich * Y.config.logLevel YUI configuration, or Console.LOG_LEVEL_INFO if
9b1ad7c4722db362bee7d39c851c94ba95f118b8Allen Rabinovich * that configuration is not set.
9b1ad7c4722db362bee7d39c851c94ba95f118b8Allen Rabinovich * Possible values are "info", "warn",
9b1ad7c4722db362bee7d39c851c94ba95f118b8Allen Rabinovich * "error" (case insensitive), or the corresponding statics
9b1ad7c4722db362bee7d39c851c94ba95f118b8Allen Rabinovich * Console.LOG_LEVEL_INFO and so on.
9b1ad7c4722db362bee7d39c851c94ba95f118b8Allen Rabinovich * @attribute logLevel
9b1ad7c4722db362bee7d39c851c94ba95f118b8Allen Rabinovich * @type String|Number
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich * @default Y.config.logLevel or Console.LOG_LEVEL_INFO
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich validator : function (v) {
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich setter : function (v) {
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich return this._setLogLevel(v);
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich * Millisecond timeout to maintain before emptying buffer of Console
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * entries to the UI.
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * @attribute printTimeout
a9a4fee30864f00049b02201b1af50ada7f769e3Allen Rabinovich * @type Number
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @default 100
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Maximum number of Console entries allowed in the Console body at one
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * time. This is used to keep acquired messages from exploding the
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich * DOM tree and impacting page performance.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @attribute consoleLimit
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @type Number
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @default 500
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * New entries should display at the top of the Console or the bottom?
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * @attribute newestOnTop
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * @type Boolean
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * @default true
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * When new entries are added to the Console UI, should they be
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * scrolled into view?
9b1ad7c4722db362bee7d39c851c94ba95f118b8Allen Rabinovich * @attribute scrollIntoView
9b1ad7c4722db362bee7d39c851c94ba95f118b8Allen Rabinovich * @type Boolean
9b1ad7c4722db362bee7d39c851c94ba95f118b8Allen Rabinovich * @default true
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * The baseline time for this Console instance, used to measure elapsed
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * time from the moment the console module is <code>use</code>d to the
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * moment each new entry is logged (not rendered).
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * This value is reset by the instance method myConsole.reset().
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich * @attribute startTime
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * @default The moment the console module is <code>use</code>d
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * The precise time the last entry was logged. Used to measure elapsed
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * time between log messages.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @attribute lastTime
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich * @default The moment the console module is <code>use</code>d
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Used to normalize input values for available logLevels.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @property Console._logLevels
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @type Object
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen RabinovichConsole._logLevels[INFO] = Console.LOG_LEVEL_INFO;
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen RabinovichConsole._logLevels[WARN] = Console.LOG_LEVEL_WARN;
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen RabinovichConsole._logLevels[ERROR] = Console.LOG_LEVEL_ERROR;
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen RabinovichConsole._logLevels[Console.LOG_LEVEL_INFO] = Console.LOG_LEVEL_INFO;
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen RabinovichConsole._logLevels[Console.LOG_LEVEL_WARN] = Console.LOG_LEVEL_WARN;
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen RabinovichConsole._logLevels[Console.LOG_LEVEL_ERROR] = Console.LOG_LEVEL_ERROR;
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Reference to the Node instance containing the head contents.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @property _head
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @default null
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich * Reference to the Node instance that will house the console messages.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @property _body
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @default null
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Reference to the Node instance containing the footer contents.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @property _head
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @default null
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Object API returned from <code>Y.later</code>. Holds the timer id
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * returned by <code>setTimout</code> for scheduling of buffered messages.
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich * @property _timeout
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @type Object
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @default null
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Array of normalized message objects awaiting printing.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @property buffer
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @type Array
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @default null
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Wrapper for <code>Y.log</code>.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @method log
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @param {Any*} * (all arguments passed through to <code>Y.log</code>)
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich log : function () {
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Clear the console of messages and flush the buffer of pending messages.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @method clearConsole
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich clearConsole : function () {
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich // TODO: clear event listeners from console contents
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Clears the console and resets internal timers.
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich * @method reset
6a0b5391dbcaace88784e407eb97b46fc8ffb619Allen Rabinovich reset : function () {
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Outputs all buffered messages to the console UI.
printBuffer: function () {
this._clearTimeout();
i,len;
this.buffer = [];
this._trimOldEntries();
printLogEntry : function (m) {
m = merge(
this._htmlEscapeMessage(m),
this._addToConsole(n);
initializer : function () {
this.buffer = [];
* @param event {Event.Facade} An Event Facade object with the following attribute specific properties added:
renderUI : function () {
this._initHead();
this._initConsole();
this._initFoot();
syncUI : function () {
bindUI : function () {
_initHead : function () {
_initConsole : function () {
_initFoot : function () {
time : new Date(),
source : null,
label : null,
localTime : null,
elapsedTime : null,
totalTime : null
_schedulePrint : function () {
this,this.printBuffer);
_htmlEscapeMessage : function (m) {
m = Y.clone(m);
_trimOldEntries : function () {
if (bd) {
_encodeHTML : function (s) {
return isString(s) ?
_clearTimeout : function () {
if (this._timeout) {
this._timeout = null;
_onPauseClick : function (e) {
_onClearClick : function (e) {
this.clearConsole();
_setLogLevel : function (v) {
_validateNewLogLevel : function (v) {
_afterStringsChange : function (e) {
el;
if (el) {
if (el) {
if (el) {
_afterPausedChange : function (e) {
if (node) {
if (!paused) {
this._schedulePrint();
} else if (this._timeout) {
this._timeout = null;
_afterConsoleLimitChange : function () {
this._trimOldEntries();
_defResetFn : function () {
this.clearConsole();
_defEntryFn : function (e) {
if (e.message) {
this._schedulePrint();