Is there any way to remove the timestamp and program name from NSLog show it does not show up in the output?


The short answer is no.

You can use the C function printf(), but that is discouraged. printf() will output to the Xcode console without the time stamp. Elsewhere, printf() behaves as NSLog() by including the time stamp. Also, printf() knows nothing of Objective-C objects, so you need to do something like

printf("%s\n", [[myObject description] UTF8String]);


Thank you for the answer! That makes perfect sense!


printf doesn’t support %@ (which just the -description) like Tom posted. You can also make your own log function using a variadic (taking arbitrary arguments) function, but still letting Cocoa do the heavy lifting.

[code]#import <Foundation/Foundation.h>

// Compile on the command-line with
// clang -g -Wall -framework Foundation -o quietlog quietlog.m

void QuietLog (NSString *format, …) {
va_list argList;
va_start (argList, format);
NSString *message = [[[NSString alloc] initWithFormat: format
arguments: argList] autorelease]; // remove autorelease for ARC
fprintf (stderr, “%s\n”, [message UTF8String]);
va_end (argList);
} // QuietLog

int main (void) {
@autoreleasepool {
QuietLog (@“Howdy %@!”, @“thar pardner”);
return 0;
} // main

Which prints out “Howdy thar pardner!” when run.