-
Notifications
You must be signed in to change notification settings - Fork 27
/
console.js
59 lines (59 loc) · 1.25 KB
/
console.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*!
* The wrapper for window.console
* @version: 1.0 (14-DEC-2011)
* @author Evgeniy `f0t0n` Naydenov
* @see http://getfirebug.com/wiki/index.php/Console_API
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
;(function() {
var debug = true;
var __console = window.console;
window.console = {};
[
'log',
'error',
'warn',
'info',
'clear',
'count',
'debug',
'trace',
'exception',
'dir',
'dirxml',
'assert',
'time',
'timeEnd',
'profile',
'profileEnd',
'group',
'groupEnd',
'memoryProfile',
'memoryProfileEnd',
'table',
'timeStamp',
'trace'
].forEach(function(method) {
window.console[method] = function() {
return (debug && __console && __console[method])
? __console[method].apply(__console, arguments)
: null;
}
});
})();
// The wrappers for most popular window.console methods:
function log() {
return window.console.log.apply(window.console, arguments);
}
function info() {
return window.console.info.apply(window.console, arguments);
}
function error() {
return window.console.error.apply(window.console, arguments);
}
function warn() {
return window.console.warn.apply(window.console, arguments);
}