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 1 commit
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
26 changes: 7 additions & 19 deletions CCDebugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,24 +312,12 @@ 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);
cc.assert = Function.prototype.bind.call(console.assert, console);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does console.assert supported on all major browsers ? including mobile browsers ?

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+++++++++++++++++++++++++++++