开发者

How to clear NSLog output from code?

开发者 https://www.devze.com 2023-02-06 21:51 出处:网络
is there a wa开发者_运维知识库y to clear console output from code? thanks.SHORTCUT I PREFER : Simply USE ⌘+K Keyboard Shortcut when you want to clear the NSLOG Data.I don\'t think it\'s poss

is there a wa开发者_运维知识库y to clear console output from code?

thanks.


SHORTCUT I PREFER :

Simply USE +K Keyboard Shortcut when you want to clear the NSLOG Data.


I don't think it's possible to do that in code.

Though there is an option in XCode preferences (Debugging tab) called Auto Clear Debug Console. It will clear console output each time you run the application. That might fit your needs.


If you search the site, you will find several ways of manipulating NSLog. I use

#ifndef __OPTIMIZE__
#    define NSLog(...) NSLog(__VA_ARGS__)
#else
#    define NSLog(...) {}
#endif

to kill the output. Put the above in your .pch file in your 'Other Sources' folder and it works out of the box for release builds. Replace OPTIMIZE with some other preprocessing flag if you want this to work for other build configurations.

0

精彩评论

暂无评论...
验证码 换一张
取 消