~bjornt/lazr-js/prefetch-yui-3.5

« back to all changes in this revision

Viewing changes to src-js/lazrjs/yui/yui/yui-log.js

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-01-14 23:32:29 UTC
  • mfrom: (197.1.7 yui-3.3.0)
  • Revision ID: launchpad@pqm.canonical.com-20110114233229-r6i4cazdiiw18o7p
Upgrade to YUI 3.3.0 [r=mars]

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3
3
Code licensed under the BSD License:
4
4
http://developer.yahoo.com/yui/license.html
5
 
version: 3.2.0
6
 
build: 2676
 
5
version: 3.3.0
 
6
build: 3167
7
7
*/
8
8
YUI.add('yui-log', function(Y) {
9
9
 
13
13
 * @module yui
14
14
 * @submodule yui-log
15
15
 */
16
 
(function() {
17
16
 
18
 
var INSTANCE  = Y,
19
 
    LOGEVENT  = 'yui:log',
 
17
var INSTANCE = Y,
 
18
    LOGEVENT = 'yui:log',
20
19
    UNDEFINED = 'undefined',
21
 
    LEVELS    = { debug: 1, 
22
 
                  info:  1, 
23
 
                  warn:  1, 
24
 
                  error: 1 };
 
20
    LEVELS = { debug: 1,
 
21
               info: 1,
 
22
               warn: 1,
 
23
               error: 1 };
25
24
 
26
25
/**
27
26
 * If the 'debug' config is true, a 'yui:log' event will be
37
36
 * @param  {String}  msg  The message to log.
38
37
 * @param  {String}  cat  The log category for the message.  Default
39
38
 *                        categories are "info", "warn", "error", time".
40
 
 *                        Custom categories can be used as well. (opt)
41
 
 * @param  {String}  src  The source of the the message (opt)
42
 
 * @param  {boolean} silent If true, the log event won't fire
43
 
 * @return {YUI}      YUI instance
 
39
 *                        Custom categories can be used as well. (opt).
 
40
 * @param  {String}  src  The source of the the message (opt).
 
41
 * @param  {boolean} silent If true, the log event won't fire.
 
42
 * @return {YUI}      YUI instance.
44
43
 */
45
44
INSTANCE.log = function(msg, cat, src, silent) {
46
45
    var bail, excl, incl, m, f,
47
 
        Y         = INSTANCE, 
48
 
        c         = Y.config,
 
46
        Y = INSTANCE,
 
47
        c = Y.config,
49
48
        publisher = (Y.fire) ? Y : YUI.Env.globalEvents;
50
49
    // suppress log message if the config is off or the event stack
51
50
    // or the event call stack contains a consumer of the yui:log event
52
51
    if (c.debug) {
53
52
        // apply source filters
54
53
        if (src) {
55
 
            excl = c.logExclude; 
 
54
            excl = c.logExclude;
56
55
            incl = c.logInclude;
57
56
            if (incl && !(src in incl)) {
58
57
                bail = 1;
82
81
                }
83
82
 
84
83
                publisher.fire(LOGEVENT, {
85
 
                    msg: msg, 
86
 
                    cat: cat, 
 
84
                    msg: msg,
 
85
                    cat: cat,
87
86
                    src: src
88
87
                });
89
88
            }
101
100
 * @param  {String}  msg  The message to log.
102
101
 * @param  {String}  cat  The log category for the message.  Default
103
102
 *                        categories are "info", "warn", "error", time".
104
 
 *                        Custom categories can be used as well. (opt)
105
 
 * @param  {String}  src  The source of the the message (opt)
106
 
 * @param  {boolean} silent If true, the log event won't fire
107
 
 * @return {YUI}      YUI instance
 
103
 *                        Custom categories can be used as well. (opt).
 
104
 * @param  {String}  src  The source of the the message (opt).
 
105
 * @param  {boolean} silent If true, the log event won't fire.
 
106
 * @return {YUI}      YUI instance.
108
107
 */
109
108
INSTANCE.message = function() {
110
109
    return INSTANCE.log.apply(INSTANCE, arguments);
111
110
};
112
111
 
113
 
})();
114
 
 
115
 
 
116
 
}, '3.2.0' ,{requires:['yui-base']});
 
112
 
 
113
}, '3.3.0' ,{requires:['yui-base']});