How do I get rid of all this garbage in NSLog?
When i use
NSLog(@"fooBar")
it prints out a lot of things that i dont want:
2009-09-03 13:46:34.531 MyApp[3703:20b] fooBar
Is there a way to print something to the console without that big prefix? I want to draw a table and some other stuff in the console so that space is critical ...
+2
HelloMoon
source
to share
3 answers
This is from Mark Dalrymple at borkware.com
http://borkware.com/quickies/single?id=261
Quieter NSLog (General-> Hacks) [permalink]
// 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
+9
source to share
This is a variation on borkware speeds: http://cocoaheads.byu.edu/wiki/a-different-nslog . It prints the file and line number where the log is located. I use it all the time.
+2
source to share