Cocos2dx 关闭Log

/// @name Cocos2d debug
/// @{
#if !defined(COCOS2D_DEBUG) || COCOS2D_DEBUG == 0
#define CCLOG(...)       do {} while (0)
#define CCLOGINFO(...)   do {} while (0)
#define CCLOGERROR(...)  do {} while (0)
#define CCLOGWARN(...)   do {} while (0)
 
#elif COCOS2D_DEBUG == 1
#define CCLOG(format, ...)      cocos2d::log(format, ##__VA_ARGS__)
#define CCLOGERROR(format,...)  cocos2d::log(format, ##__VA_ARGS__)
#define CCLOGINFO(format,...)   do {} while (0)
#define CCLOGWARN(...) __CCLOGWITHFUNCTION(__VA_ARGS__)
 
#elif COCOS2D_DEBUG > 1
#define CCLOG(format, ...)      cocos2d::log(format, ##__VA_ARGS__)
#define CCLOGERROR(format,...)  cocos2d::log(format, ##__VA_ARGS__)
#define CCLOGINFO(format,...)   cocos2d::log(format, ##__VA_ARGS__)
#define CCLOGWARN(...) __CCLOGWITHFUNCTION(__VA_ARGS__)
#endif // COCOS2D_DEBUG

从代码中看出,只要控制COCOS2D_DEBUG即可控制CCLOG
Win32

属性->通用属性  ->C/C++ ->预处理器 ->预处理器定义->编辑  

COCOS2D_DEBUG 改为0

Android

Application.mk  -> -DCOCOS2D_DEBUG改为0

iOS

Xcode build setting -> COCOS2D_DEBUG 改为0

如果在项目中直接用log输出而非CCLOG则此方法无效

912sy.com download resources are from the network, only for learning and reference use, the copyright belongs to the original author, do not use for commercial purposes, please remove yourself within 24 hours after downloading.
If the content published on this site inadvertently violates your rights and interests, please contact us and the site will be deleted within one business day.If you encounter any problems please contact customer service QQ:2385367137
912sy " Cocos2dx 关闭CCLOG