6 window.tantrum = function(context, task, message)
8 this.context = context;
10 this.message = message;
11 bug.error('EXCEPTION on ' + context, task, message);
21 * 2 : Errors and warnings
22 * 3 : Errors, warnings and information
23 * 4 : Errors, warnings, information and dumps
24 * 5 : Flood mode, hope you can swim
31 * Set debug verbosity level.
32 * @param {Number} level Debug verbosity level
34 setLevel : function(level)
36 bug._debugLevel = level;
40 * Start a logging group.
41 * @param {String} groupName Name of the group
43 group : function(groupName)
45 console.groupCollapsed(groupName);
49 * End the current logging group.
58 * @param {String} context Module, class or object context
59 * @param {String} task The task
60 * @param {Unknown} data The data to log
62 error : function(context, task, data)
64 if (0 < bug._debugLevel)
66 bug._handle('', 'error', context, task, data);
72 * @param {String} context Module, class or object context
73 * @param {String} task The task
74 * @param {Unknown} data The data to log
76 warn : function(context, task, data)
78 if (1 < bug._debugLevel)
80 bug._handle('', 'warn', context, task, data);
83 debug : function(context, task, data)
85 if (1 < bug._debugLevel)
87 bug._handle('-oO- ', 'warn', context, task, data);
92 * Log some information.
93 * @param {String} context Module, class or object context
94 * @param {String} task The task
95 * @param {Unknown} data The data to log
97 info : function(context, task, data)
99 if (2 < bug._debugLevel)
101 bug._handle('(i) ', 'log', context, task, data);
106 * Dump some information, probably lots of it.
107 * @param {String} context Module, class or object context
108 * @param {String} task The task
109 * @param {Unknown} data The data to log
111 dump : function(context, task, data)
113 if (3 < bug._debugLevel)
115 bug._handle('<dump> ', 'log', context, task, data);
120 * Drown the developer in tons of information.
121 * @param {String} context Module, class or object context
122 * @param {String} task The task
123 * @param {Unknown} data The data to log
125 drown : function(context, task, data)
127 if (4 < bug._debugLevel)
129 bug._handle('..... ', 'log', context, task, data);
134 * Internal utility to do the actual logging.
135 * @param {String} level Logging level
136 * @param {String} method Console method to use
137 * @param {String} context Module, class or object context
138 * @param {String} task The task
139 * @param {Unknown} data The data to log
141 _handle : function(level, method, context, task, data, wrap)
143 if (undefined == data && undefined == task)
145 console[method](level, context);
147 else if (undefined == data)
149 console[method](level + context, task);
153 console[method](level + context + ':' + task, data);