2 iphone cocoa cocoa-touch objective-c uikit
我用的时候
NSLog(@"fooBar")
Run Code Online (Sandbox Code Playgroud)
它打印出很多我不想要的东西:
2009-09-03 13:46:34.531 MyApp[3703:20b] fooBar
Run Code Online (Sandbox Code Playgroud)
有没有办法在没有这个大前缀的情况下将某些内容打印到控制台?我想在控制台中画一张桌子和其他东西,这样空间才是至关重要的......
小智 9
这是来自borkware.com的Mark Dalrymple
http://borkware.com/quickies/single?id=261
更安静的NSLog(通用 - >黑客)[永久链接]
// NSLog() writes out entirely too much stuff. Most of the time I'm
// not interested in the program name, process ID, and current time
// down to the subsecond level.
// This takes an NSString with printf-style format, and outputs it.
// regular old printf can't be used instead because it doesn't
// support the '%@' format option.
void QuietLog (NSString *format, ...)
{
va_list argList;
va_start (argList, format);
NSString *message = [[[NSString alloc] initWithFormat: format
arguments: argList] autorelease];
printf ("%s", [message UTF8String]);
va_end (argList);
} // QuietLog
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1011 次 |
| 最近记录: |