In Xcode, is there a way to disable the timestamps that appear in the debugger console when calling NSLog?

Viewed 11288

Xcode's debugger console makes it easy to see any debugging messages my app sends out using NSLog(), but it always sticks a timestamp prefix on them:

2009-08-30 04:54:48.128 MyApp[94652:a0f] some log message
2009-08-30 04:54:50.647 MyApp[94652:a0f] another log message
...

I have no use for this prefix, and it takes up a lot of room. I have a feeling it is hard-coded into Apple's logging system, but just in case there is a solution out there:

Can I have the debugger console show me log messages without the timestamp prefix?

Something like this would be perfect:

some log message
another log message
...
8 Answers

Clean Log Macro

Here is a macro I've made for this purpose. It works exactly like NSLog but with just your text, no extra info


Macro (paste to your .h)

#define CLog(__string, ...) fprintf(stderr, "\n%s", [([NSString stringWithFormat:__string, ##__VA_ARGS__]) UTF8String])

Example use:

CLog(@"I am %i days and %i years old", 3, 7);

Logs:

I am 3 days and 7 years old

Related