Skip to content

Show line number in console statements #3289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 12, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 17 additions & 18 deletions CCDebugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,24 +312,23 @@ cc._initDebugSetting = function (mode) {
} else if(console && console.log.apply){//console is null when user doesn't open dev tool on IE9
//log to console

cc.error = function(){
return console.error.apply(console, arguments);
};
cc.assert = function (cond, msg) {
if (!cond && msg) {
for (var i = 2; i < arguments.length; i++)
msg = msg.replace(/(%s)|(%d)/, cc._formatString(arguments[i]));
throw new Error(msg);
}
};
if(mode !== ccGame.DEBUG_MODE_ERROR)
cc.warn = function(){
return console.warn.apply(console, arguments);
};
if(mode === ccGame.DEBUG_MODE_INFO)
cc.log = function(){
return console.log.apply(console, arguments);
cc.error = Function.prototype.bind.call(console.error, console);
//If console.assert is not support user throw Error msg on wrong condition
if (console.assert) {
cc.assert = Function.prototype.bind.call(console.assert, console);
} else {
cc.assert = function (cond, msg) {
if (!cond && msg) {
for (var i = 2; i < arguments.length; i++)
msg = msg.replace(/(%s)|(%d)/, cc._formatString(arguments[i]));
throw new Error(msg);
}
};
}
if (mode !== ccGame.DEBUG_MODE_ERROR)
cc.warn = Function.prototype.bind.call(console.warn, console);
if (mode === ccGame.DEBUG_MODE_INFO)
cc.log = Function.prototype.bind.call(console.log, console);
}
};
//+++++++++++++++++++++++++something about log end+++++++++++++++++++++++++++++
//+++++++++++++++++++++++++something about log end+++++++++++++++++++++++++++++