Re: No longer use NSLog() in Xcode 4?
Re: No longer use NSLog() in Xcode 4?
- Subject: Re: No longer use NSLog() in Xcode 4?
- From: Gerd Knops <email@hidden>
- Date: Fri, 16 Sep 2011 12:38:33 -0500
On Sep 16, 2011, at 11:32 AM, George Warner wrote:
>
> This is what I use in my pre-compiled header:
>
> #ifdef DEBUG
> #define NSLogDebug(format, ...) \
> NSLog(@"<%s:%d> %s, " format, \
> strrchr("/" __FILE__, '/') + 1, __LINE__, __PRETTY_FUNCTION__, ## __VA_ARGS__)
> #else
> #define NSLogDebug(format, ...)
> #endif
>
> Then in the debug configuration define DEBUG:
>
> GCC_PREPROCESSOR_DEFINITIONS = $(value) DEBUG=1
>
> So without changing anything my release builds have all their NSLogDebug's no-op'd out. Plus the format, __VA_ARGS__ allow me to do things like:
>
> - (void) windowWillClose: (NSNotification *) notification {
> NSLogDebug(@"id:%@, notification: <%@>", [self uniqueID], notification);
> .
> .
> .
> } // windowWillClose:
>
> Which logs:
>
> 2011-09-16 09:09:39.727 CSR Progress Meter[39032:707] <ProgressMeter.m:188> -[ProgressMeter windowWillClose:], id:SPM-39032-1, notification: <NSConcreteNotification 0x100345260 {name = NSWindowWillCloseNotification; object = <NSWindow: 0x10014ef90>}>
>
That's what I have been using. Now wouldn't it be cool if "2011-09-16 09:09:39.727 CSR Progress Meter[39032:707] <ProgressMeter.m:188>" could be reduced to a *clickable link* "ProgressMeter.m:188"? I mostly use TextMate for Cocoa development, and modified the Console there to do just that. Immensely useful. To bad Xcode can't do that!
Gerd
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden