Developers Manual > Cocos2d-JS > Features Of Cocos2d-JS > Print Logs by cclog

Print Logs by cc.log

version: cocos2d-js v3.x
update: Updated about 2 years ago

There are two changes to log apis:

  • Add cc.warn, cc.error.
  • Refactor cc.Assert to cc.assert for fitting the API style

Examples:

1
2
3
4
5
6
7
8
9
10
11
cc.log("this is a log");
cc.log("this is a log for %s", "Cocos2d-html5");

cc.warn("this is a warning");
cc.warn("this is a warning for %s", "Cocos2d-html5");

cc.error("this is an error");
cc.error("this is an error for %s", "Cocos2d-html5");

cc.assert(false, "this is an assert");
cc.assert(false, "this is an assert for %s", "Cocos2d-html5");

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.