iphone-common-codes-ccteam源代码 CCLog.h

本文详细介绍了CCLog宏的定义与用法,包括日志级别设置、参数化输出、视图信息打印等特性,旨在帮助开发者高效进行iOS应用的日志记录。
// // CCLog.h // CCFC // // Created by xichen on 11-12-17. // Copyright 2011年 ccteam. All rights reserved. // #import <Foundation/Foundation.h> #import "CCUIView.h" #import "CCCommon.h" #define C_LOG(cStr, ...) printf(cStr, ##__VA_ARGS__) #define C_LOG_ENDL(cStr, ...) printf(cStr"\n", ##__VA_ARGS__) #define LOG(cStr, ...) NSLog(@cStr, ##__VA_ARGS__) #ifdef __cplusplus #define CPP_LOG(cStr) std::cout << (cStr); #define CPP_LOG_ENDL(cStr) std::cout << (cStr) << std::endl; #endif #define LOG_DETAIL(cStr) \ NSLog(@"filename: %s line: %d %s", __FILE__, __LINE__, (cStr)) // 输出UIView的rect信息宏 #define LOG_VIEW_RECT(view) \ LOG(#view" rect's x:%f, y:%f, width:%f, height:%f", \ GET_VIEW_X(view), GET_VIEW_Y(view), \ GET_VIEW_WIDTH(view), GET_VIEW_HEIGHT(view)) #define LOG_VIEW_BOUND(view) \ LOG(#view" bound's x:%f, y:%f, width:%f, height:%f", \ view.bounds.origin.x, view.bounds.origin.y, \ view.bounds.size.width, view.bounds.size.height) // 日志打印进入某函数 #define LOG_ENTER_FUNC(cStrFunc) LOG("enter function "#cStrFunc) // 日志打印离开某函数 #define LOG_LEAVE_FUNC(cStrFunc) LOG("leave function "#cStrFunc) // 成功、失败 #define LOG_SUCCESS LOG("Successfully!") #define LOG_FAILED LOG("Failed!") #define LOG_STARS LOG("***************************"); #define LOG_ARR(arr) LOG("arr is %@", arr); #define LOG_HERE LOG_DETAIL(""); #define LOG_ID(obj) LOG(#obj" is %@", (obj)); #define LOG_STR(str) LOG(#str" is %@", (str)); #define LOG_INT(intValue) LOG(#intValue" is %d", (intValue)); #define LOG_LONG(longValue) LOG(#longValue" is %ld", (longValue)); #define LOG_CHAR(charValue) LOG(#charValue" is %c", (charValue)); #define LOG_DOUBLE(doubleValue) LOG(#doubleValue" is %f", (doubleValue)); #define LOG_BOOL(b) LOG(#b" is %s", TO_BOOL_STR(b)); #define LOG_POINTER(p) LOG(#p" is %p", (p)); #define LOG_CSTR(cStr) LOG(#cStr" is %s", (cStr)); #define LOG_ARR_EX(arr) \ { \ LOG(#arr"is %@", arr); \ for(id temp in arr) \ LOG_ID(temp); \ } #define LOG_SIZE(size) LOG(#size" is %@", NSStringFromCGSize(size)); #define LOG_POINT(p) LOG(#p" is %@", NSStringFromCGPoint(p)); #define LOG_RECT(rect) LOG(#rect" is %@", NSStringFromCGRect(rect)); #define LOG_SEL(sel) LOG_CSTR(sel); #define LOG_IMP(imp) LOG_POINTER(imp); @interface CCLog : NSObject { } + (void)logDetail:(NSString *)str; @end


googlecode链接地址(会有更新):http://code.google.com/p/iphone-common-codes-ccteam/source/browse/trunk/CCFC/files/CCLog.h

github地址:https://github.com/cxsjabc/iphone-common-codes-ccteam/tree/master/CCFC/files/CCLog.h


评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值