weekly release 2.4dev
[moodle.git] / lib / yuilib / 3.7.1 / build / yui-log / yui-log-coverage.js
blob2173f73f20983a0c9c873fac544705828fdfd8de
1 /*
2 YUI 3.7.1 (build 5627)
3 Copyright 2012 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
6 */
7 if (typeof _yuitest_coverage == "undefined"){
8     _yuitest_coverage = {};
9     _yuitest_coverline = function(src, line){
10         var coverage = _yuitest_coverage[src];
11         if (!coverage.lines[line]){
12             coverage.calledLines++;
13         }
14         coverage.lines[line]++;
15     };
16     _yuitest_coverfunc = function(src, name, line){
17         var coverage = _yuitest_coverage[src],
18             funcId = name + ":" + line;
19         if (!coverage.functions[funcId]){
20             coverage.calledFunctions++;
21         }
22         coverage.functions[funcId]++;
23     };
25 _yuitest_coverage["build/yui-log/yui-log.js"] = {
26     lines: {},
27     functions: {},
28     coveredLines: 0,
29     calledLines: 0,
30     coveredFunctions: 0,
31     calledFunctions: 0,
32     path: "build/yui-log/yui-log.js",
33     code: []
35 _yuitest_coverage["build/yui-log/yui-log.js"].code=["YUI.add('yui-log', function (Y, NAME) {","","/**"," * Provides console log capability and exposes a custom event for"," * console implementations. This module is a `core` YUI module, <a href=\"../classes/YUI.html#method_log\">it's documentation is located under the YUI class</a>."," *"," * @module yui"," * @submodule yui-log"," */","","var INSTANCE = Y,","    LOGEVENT = 'yui:log',","    UNDEFINED = 'undefined',","    LEVELS = { debug: 1,","               info: 1,","               warn: 1,","               error: 1 };","","/**"," * If the 'debug' config is true, a 'yui:log' event will be"," * dispatched, which the Console widget and anything else"," * can consume.  If the 'useBrowserConsole' config is true, it will"," * write to the browser console if available.  YUI-specific log"," * messages will only be present in the -debug versions of the"," * JS files.  The build system is supposed to remove log statements"," * from the raw and minified versions of the files."," *"," * @method log"," * @for YUI"," * @param  {String}  msg  The message to log."," * @param  {String}  cat  The log category for the message.  Default"," *                        categories are \"info\", \"warn\", \"error\", time\"."," *                        Custom categories can be used as well. (opt)."," * @param  {String}  src  The source of the the message (opt)."," * @param  {boolean} silent If true, the log event won't fire."," * @return {YUI}      YUI instance."," */","INSTANCE.log = function(msg, cat, src, silent) {","    var bail, excl, incl, m, f,","        Y = INSTANCE,","        c = Y.config,","        publisher = (Y.fire) ? Y : YUI.Env.globalEvents;","    // suppress log message if the config is off or the event stack","    // or the event call stack contains a consumer of the yui:log event","    if (c.debug) {","        // apply source filters","        src = src || \"\";","        if (typeof src !== \"undefined\") {","            excl = c.logExclude;","            incl = c.logInclude;","            if (incl && !(src in incl)) {","                bail = 1;","            } else if (incl && (src in incl)) {","                bail = !incl[src];","            } else if (excl && (src in excl)) {","                bail = excl[src];","            }","        }","        if (!bail) {","            if (c.useBrowserConsole) {","                m = (src) ? src + ': ' + msg : msg;","                if (Y.Lang.isFunction(c.logFn)) {","                    c.logFn.call(Y, msg, cat, src);","                } else if (typeof console != UNDEFINED && console.log) {","                    f = (cat && console[cat] && (cat in LEVELS)) ? cat : 'log';","                    console[f](m);","                } else if (typeof opera != UNDEFINED) {","                    opera.postError(m);","                }","            }","","            if (publisher && !silent) {","","                if (publisher == Y && (!publisher.getEvent(LOGEVENT))) {","                    publisher.publish(LOGEVENT, {","                        broadcast: 2","                    });","                }","","                publisher.fire(LOGEVENT, {","                    msg: msg,","                    cat: cat,","                    src: src","                });","            }","        }","    }","","    return Y;","};","","/**"," * Write a system message.  This message will be preserved in the"," * minified and raw versions of the YUI files, unlike log statements."," * @method message"," * @for YUI"," * @param  {String}  msg  The message to log."," * @param  {String}  cat  The log category for the message.  Default"," *                        categories are \"info\", \"warn\", \"error\", time\"."," *                        Custom categories can be used as well. (opt)."," * @param  {String}  src  The source of the the message (opt)."," * @param  {boolean} silent If true, the log event won't fire."," * @return {YUI}      YUI instance."," */","INSTANCE.message = function() {","    return INSTANCE.log.apply(INSTANCE, arguments);","};","","","}, '3.7.1', {\"requires\": [\"yui-base\"]});"];
36 _yuitest_coverage["build/yui-log/yui-log.js"].lines = {"1":0,"11":0,"38":0,"39":0,"45":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"72":0,"74":0,"75":0,"80":0,"89":0,"105":0,"106":0};
37 _yuitest_coverage["build/yui-log/yui-log.js"].functions = {"log:38":0,"message:105":0,"(anonymous 1):1":0};
38 _yuitest_coverage["build/yui-log/yui-log.js"].coveredLines = 32;
39 _yuitest_coverage["build/yui-log/yui-log.js"].coveredFunctions = 3;
40 _yuitest_coverline("build/yui-log/yui-log.js", 1);
41 YUI.add('yui-log', function (Y, NAME) {
43 /**
44  * Provides console log capability and exposes a custom event for
45  * console implementations. This module is a `core` YUI module, <a href="../classes/YUI.html#method_log">it's documentation is located under the YUI class</a>.
46  *
47  * @module yui
48  * @submodule yui-log
49  */
51 _yuitest_coverfunc("build/yui-log/yui-log.js", "(anonymous 1)", 1);
52 _yuitest_coverline("build/yui-log/yui-log.js", 11);
53 var INSTANCE = Y,
54     LOGEVENT = 'yui:log',
55     UNDEFINED = 'undefined',
56     LEVELS = { debug: 1,
57                info: 1,
58                warn: 1,
59                error: 1 };
61 /**
62  * If the 'debug' config is true, a 'yui:log' event will be
63  * dispatched, which the Console widget and anything else
64  * can consume.  If the 'useBrowserConsole' config is true, it will
65  * write to the browser console if available.  YUI-specific log
66  * messages will only be present in the -debug versions of the
67  * JS files.  The build system is supposed to remove log statements
68  * from the raw and minified versions of the files.
69  *
70  * @method log
71  * @for YUI
72  * @param  {String}  msg  The message to log.
73  * @param  {String}  cat  The log category for the message.  Default
74  *                        categories are "info", "warn", "error", time".
75  *                        Custom categories can be used as well. (opt).
76  * @param  {String}  src  The source of the the message (opt).
77  * @param  {boolean} silent If true, the log event won't fire.
78  * @return {YUI}      YUI instance.
79  */
80 _yuitest_coverline("build/yui-log/yui-log.js", 38);
81 INSTANCE.log = function(msg, cat, src, silent) {
82     _yuitest_coverfunc("build/yui-log/yui-log.js", "log", 38);
83 _yuitest_coverline("build/yui-log/yui-log.js", 39);
84 var bail, excl, incl, m, f,
85         Y = INSTANCE,
86         c = Y.config,
87         publisher = (Y.fire) ? Y : YUI.Env.globalEvents;
88     // suppress log message if the config is off or the event stack
89     // or the event call stack contains a consumer of the yui:log event
90     _yuitest_coverline("build/yui-log/yui-log.js", 45);
91 if (c.debug) {
92         // apply source filters
93         _yuitest_coverline("build/yui-log/yui-log.js", 47);
94 src = src || "";
95         _yuitest_coverline("build/yui-log/yui-log.js", 48);
96 if (typeof src !== "undefined") {
97             _yuitest_coverline("build/yui-log/yui-log.js", 49);
98 excl = c.logExclude;
99             _yuitest_coverline("build/yui-log/yui-log.js", 50);
100 incl = c.logInclude;
101             _yuitest_coverline("build/yui-log/yui-log.js", 51);
102 if (incl && !(src in incl)) {
103                 _yuitest_coverline("build/yui-log/yui-log.js", 52);
104 bail = 1;
105             } else {_yuitest_coverline("build/yui-log/yui-log.js", 53);
106 if (incl && (src in incl)) {
107                 _yuitest_coverline("build/yui-log/yui-log.js", 54);
108 bail = !incl[src];
109             } else {_yuitest_coverline("build/yui-log/yui-log.js", 55);
110 if (excl && (src in excl)) {
111                 _yuitest_coverline("build/yui-log/yui-log.js", 56);
112 bail = excl[src];
113             }}}
114         }
115         _yuitest_coverline("build/yui-log/yui-log.js", 59);
116 if (!bail) {
117             _yuitest_coverline("build/yui-log/yui-log.js", 60);
118 if (c.useBrowserConsole) {
119                 _yuitest_coverline("build/yui-log/yui-log.js", 61);
120 m = (src) ? src + ': ' + msg : msg;
121                 _yuitest_coverline("build/yui-log/yui-log.js", 62);
122 if (Y.Lang.isFunction(c.logFn)) {
123                     _yuitest_coverline("build/yui-log/yui-log.js", 63);
124 c.logFn.call(Y, msg, cat, src);
125                 } else {_yuitest_coverline("build/yui-log/yui-log.js", 64);
126 if (typeof console != UNDEFINED && console.log) {
127                     _yuitest_coverline("build/yui-log/yui-log.js", 65);
128 f = (cat && console[cat] && (cat in LEVELS)) ? cat : 'log';
129                     _yuitest_coverline("build/yui-log/yui-log.js", 66);
130 console[f](m);
131                 } else {_yuitest_coverline("build/yui-log/yui-log.js", 67);
132 if (typeof opera != UNDEFINED) {
133                     _yuitest_coverline("build/yui-log/yui-log.js", 68);
134 opera.postError(m);
135                 }}}
136             }
138             _yuitest_coverline("build/yui-log/yui-log.js", 72);
139 if (publisher && !silent) {
141                 _yuitest_coverline("build/yui-log/yui-log.js", 74);
142 if (publisher == Y && (!publisher.getEvent(LOGEVENT))) {
143                     _yuitest_coverline("build/yui-log/yui-log.js", 75);
144 publisher.publish(LOGEVENT, {
145                         broadcast: 2
146                     });
147                 }
149                 _yuitest_coverline("build/yui-log/yui-log.js", 80);
150 publisher.fire(LOGEVENT, {
151                     msg: msg,
152                     cat: cat,
153                     src: src
154                 });
155             }
156         }
157     }
159     _yuitest_coverline("build/yui-log/yui-log.js", 89);
160 return Y;
164  * Write a system message.  This message will be preserved in the
165  * minified and raw versions of the YUI files, unlike log statements.
166  * @method message
167  * @for YUI
168  * @param  {String}  msg  The message to log.
169  * @param  {String}  cat  The log category for the message.  Default
170  *                        categories are "info", "warn", "error", time".
171  *                        Custom categories can be used as well. (opt).
172  * @param  {String}  src  The source of the the message (opt).
173  * @param  {boolean} silent If true, the log event won't fire.
174  * @return {YUI}      YUI instance.
175  */
176 _yuitest_coverline("build/yui-log/yui-log.js", 105);
177 INSTANCE.message = function() {
178     _yuitest_coverfunc("build/yui-log/yui-log.js", "message", 105);
179 _yuitest_coverline("build/yui-log/yui-log.js", 106);
180 return INSTANCE.log.apply(INSTANCE, arguments);
184 }, '3.7.1', {"requires": ["yui-base"]});