Skip to content

Commit 46649d7

Browse files
committed
Show line number in console statements
1 parent ed478e5 commit 46649d7

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

CCDebugger.js

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -312,24 +312,12 @@ cc._initDebugSetting = function (mode) {
312312
} else if(console && console.log.apply){//console is null when user doesn't open dev tool on IE9
313313
//log to console
314314

315-
cc.error = function(){
316-
return console.error.apply(console, arguments);
317-
};
318-
cc.assert = function (cond, msg) {
319-
if (!cond && msg) {
320-
for (var i = 2; i < arguments.length; i++)
321-
msg = msg.replace(/(%s)|(%d)/, cc._formatString(arguments[i]));
322-
throw new Error(msg);
323-
}
324-
};
325-
if(mode !== ccGame.DEBUG_MODE_ERROR)
326-
cc.warn = function(){
327-
return console.warn.apply(console, arguments);
328-
};
329-
if(mode === ccGame.DEBUG_MODE_INFO)
330-
cc.log = function(){
331-
return console.log.apply(console, arguments);
332-
};
315+
cc.error = Function.prototype.bind.call(console.error, console);
316+
cc.assert = Function.prototype.bind.call(console.assert, console);
317+
if (mode !== ccGame.DEBUG_MODE_ERROR)
318+
cc.warn = Function.prototype.bind.call(console.warn, console);
319+
if (mode === ccGame.DEBUG_MODE_INFO)
320+
cc.log = Function.prototype.bind.call(console.log, console);
333321
}
334322
};
335-
//+++++++++++++++++++++++++something about log end+++++++++++++++++++++++++++++
323+
//+++++++++++++++++++++++++something about log end+++++++++++++++++++++++++++++

0 commit comments

Comments
 (0)