替代NSLog的几种方式
来源:互联网 发布:四三九九网络股份 编辑:程序博客网 时间:2024/05/22 03:45
//DLog will output like NSLog only when the DEBUG variable is set
#ifdef DEBUG
//# define NSLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
//A better version of NSLog
#define NSLog(format, ...) do { \
fprintf(stderr, "<%s : %d> %s\n", \
[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], \
__LINE__, __func__); \
(NSLog)((format), ##__VA_ARGS__); \
fprintf(stderr, "-------\n"); \
} while (0)
#else
# define NSLog(...)
#endif
//----------------------------------------------------
// ALog will always output like NSLog
#define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
// ULog will show the UIAlertView only when the DEBUG variable is set
#ifdef DEBUG
# define ULog(fmt, ...) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"%s\n [Line %d] ", __PRETTY_FUNCTION__, __LINE__] message:[NSString stringWithFormat:fmt, ##__VA_ARGS__] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; }
#else
# define ULog(...)
#endif
- 替代NSLog的几种方式
- linux多线程编程,替代sleep的几种方式
- linux多线程编程,替代sleep的几种方式
- 替代反射调用的几种方式及性能测试
- 替代反射调用的几种方式及性能测试
- 替代NSLog
- 替代NSLog
- 替代NSLog
- iOS开发, 关于nslog的几种用法
- NSLog输出的格式方式
- Dlog 替代 NSLog
- 替代Eval的两种方式
- Python执行shell脚本的几种方式(最好用subprocess.Popen来替代os.system)
- 自定义输出宏替代NSLog
- 使用CSS替代JS实现几种常见的特效
- 程序“运行方式...”的替代
- 程序“运行方式...”的替代
- 绘图的几种方式
- Hadoop 安装流程
- 外媒:失联客机可能不在水里 搜救地点或有误
- ios 本的化(localizations)工程流程
- CentOS6.4下Mysql数据库的安装与配置
- exception1--need cast convert
- 替代NSLog的几种方式
- HQL查询示例
- Android 实现由下至上弹出并位于屏幕底部的提示框
- GPDB管理员笔记(三)装载和卸载数据
- inner join on, left join on, right join on详细使用方法
- Linux运行时I/O设备的电源管理框架
- Exchange Storage
- js中checkbox长度为undefinde如何解决以及取checkbox有多少被选中
- 怎样在VS2010中打开vs2012的项目