Re: NSLog on releasebuild

2008-07-24 Thread Nate Weaver

You're right, of course (I forgot about this).

I think I decided not to worry about it too much since it shouldn't  
make it into production code (if it does, then I did something wrong).  
My main goal was to keep the macro as simple as I could (or at least,  
not have to break it onto multiple lines), and having the full path to  
a file felt like it would add to the clutter.


On Jul 23, 2008, at 6:24 PM, Jean-Daniel Dupas wrote:

By carefull with the basename function. Theoricaly, it require a  
mutable string (char * and not const char *), so this logging  
function may crash (even it for now it works).


Le 23 juil. 08 à 20:01, Nate Weaver a écrit :

This is the route I follow. I use normal NSLog() statements for  
conditions that should never happen, and DebugLog() for debugging:


#ifdef DEBUG
#define DebugLog(s, ...) NSLog((@%s %s:%d  s), __func__,  
basename(__FILE__), __LINE__, ## __VA_ARGS__);

#else
#define DebugLog(s, ...)
#endif

The extra info is for context.

On Jul 23, 2008, at 11:22 AM, Shawn Erickson wrote:


On Wed, Jul 23, 2008 at 7:48 AM, Mike [EMAIL PROTECTED] wrote:

Hello,

During development and debug I typically use tons of NSLog()- 
messages to get

info what's happening.
I don't wish to include these messages to release-build so what is
common/recommended way to get rid of them?

Should I comment them all out or is there some easier way to  
disable them or

should I just leave them as they are?


In theory you could do something like the following (not tried  
this myself)...


#if defined(DEBUG) // or some other trigger for debug logging
#define DLog(...) NSLog( __VA_ARGS__ )
#else
#define DLog(...)
#endif

... then in code ...

DLog(@blah);
DLog(@blah %@, someObject);
etc.

-Shawn

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSLog on releasebuild

2008-07-24 Thread Michael Ash
On Thu, Jul 24, 2008 at 1:35 PM, Nate Weaver [EMAIL PROTECTED] wrote:
 You're right, of course (I forgot about this).

 I think I decided not to worry about it too much since it shouldn't make it
 into production code (if it does, then I did something wrong). My main goal
 was to keep the macro as simple as I could (or at least, not have to break
 it onto multiple lines), and having the full path to a file felt like it
 would add to the clutter.

Putting potentially subtle and difficult-to-find bugs in your
debugging code is in many ways worse than putting into your production
code, since it's really tough to debug stuff if you can't even rely on
the code that lets you find out what's wrong.

As a real simple fix, [[NSString stringWithUTF8String:__FILE__]
lastPathComponent] will give you equivalent functionality without the
mess, if you use %@ instead of %s in the format string.

Mike
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSLog on releasebuild

2008-07-23 Thread Ian was here
Try this


#ifdef DEBUG
 NSLog(Whatever);
#endif





--- On Wed, 7/23/08, Mike [EMAIL PROTECTED] wrote:

 From: Mike [EMAIL PROTECTED]
 Subject: NSLog on releasebuild
 To: Cocoa-Dev List Cocoa-dev@lists.apple.com
 Date: Wednesday, July 23, 2008, 7:48 AM
 Hello,
 
 During development and debug I typically use tons of
 NSLog()-messages  
 to get info what's happening.
 I don't wish to include these messages to release-build
 so what is  
 common/recommended way to get rid of them?
 
 Should I comment them all out or is there some easier way
 to disable  
 them or should I just leave them as they are?
 
 Thanks.
 
 -Mike
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to
 the list.
 Contact the moderators at
 cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/howlewere%40yahoo.com
 
 This email sent to [EMAIL PROTECTED]


  
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSLog on releasebuild

2008-07-23 Thread Andrew Merenbach

Hi!

I think that you would want an @ symbol before the opening quote:

NSLog(@Whatever);

Cheers,
Andrew

On Jul 23, 2008, at 8:18 AM, Ian was here wrote:


Try this


#ifdef DEBUG
NSLog(Whatever);
#endif





--- On Wed, 7/23/08, Mike [EMAIL PROTECTED] wrote:


From: Mike [EMAIL PROTECTED]
Subject: NSLog on releasebuild
To: Cocoa-Dev List Cocoa-dev@lists.apple.com
Date: Wednesday, July 23, 2008, 7:48 AM
Hello,

During development and debug I typically use tons of
NSLog()-messages
to get info what's happening.
I don't wish to include these messages to release-build
so what is
common/recommended way to get rid of them?

Should I comment them all out or is there some easier way
to disable
them or should I just leave them as they are?

Thanks.

-Mike
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to
the list.
Contact the moderators at
cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/howlewere 
%40yahoo.com


This email sent to [EMAIL PROTECTED]




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/andrew.merenbach%40ucla.edu

This email sent to [EMAIL PROTECTED]




smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: NSLog on releasebuild

2008-07-23 Thread Andrew Merenbach
I'd say that the most important reason for removing the NSLog()  
statements *might* be the look of the program.  Many users who use the  
Console probably wouldn't like it to become cluttered with detritus  
from spurious log statements.  It makes tech support more difficult if  
they need to look at their logs for something else, and may confuse  
the user -- What does ... mean??? Is something wrong?  Just a  
thought.


Cheers,
Andrew

On Jul 23, 2008, at 8:33 AM, Phillip Jacobs wrote:

Is there anything particularly wrong with NSLog statements being in  
a release package? Performance wise? Security wise? Just wondering  
the root of the question.


Thanks,
-Phillip

On Jul 23, 2008, at 10:30 AM, Andrew Merenbach wrote:


Hi!

I think that you would want an @ symbol before the opening quote:

NSLog(@Whatever);

Cheers,
Andrew

On Jul 23, 2008, at 8:18 AM, Ian was here wrote:


Try this


#ifdef DEBUG
NSLog(Whatever);
#endif





--- On Wed, 7/23/08, Mike [EMAIL PROTECTED] wrote:


From: Mike [EMAIL PROTECTED]
Subject: NSLog on releasebuild
To: Cocoa-Dev List Cocoa-dev@lists.apple.com
Date: Wednesday, July 23, 2008, 7:48 AM
Hello,

During development and debug I typically use tons of
NSLog()-messages
to get info what's happening.
I don't wish to include these messages to release-build
so what is
common/recommended way to get rid of them?

Should I comment them all out or is there some easier way
to disable
them or should I just leave them as they are?

Thanks.

-Mike
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to
the list.
Contact the moderators at
cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/howlewere%40yahoo.com

This email sent to [EMAIL PROTECTED]




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/andrew.merenbach%40ucla.edu

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/pjacobs%40cosential.com

This email sent to [EMAIL PROTECTED]






smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: NSLog on releasebuild

2008-07-23 Thread Shawn Erickson
On Wed, Jul 23, 2008 at 7:48 AM, Mike [EMAIL PROTECTED] wrote:
 Hello,

 During development and debug I typically use tons of NSLog()-messages to get
 info what's happening.
 I don't wish to include these messages to release-build so what is
 common/recommended way to get rid of them?

 Should I comment them all out or is there some easier way to disable them or
 should I just leave them as they are?

In theory you could do something like the following (not tried this myself)...

#if defined(DEBUG) // or some other trigger for debug logging
#define DLog(...) NSLog( __VA_ARGS__ )
#else
#define DLog(...)
#endif

... then in code ...

DLog(@blah);
DLog(@blah %@, someObject);
etc.

-Shawn
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSLog on releasebuild

2008-07-23 Thread Shawn Erickson
On Wed, Jul 23, 2008 at 8:33 AM, Phillip Jacobs [EMAIL PROTECTED] wrote:
 Is there anything particularly wrong with NSLog statements being in a
 release package? Performance wise? Security wise? Just wondering the root of
 the question.

1) Possible performance issue (just burning CPU for something not
helping the user).
2) Possible battery issue because your logging keeps disk spun up.
3) You application is likely larger then it needs to be.
4) You clutter the users console log with things that they likely
don't benefit from.
5) You could be spraying out private information that others could
snoop (depending on what you log).
...etc...

For our products have a logging system of our own (may retool it to
use ASL on Mac OS X) that has a few logging levels defined and based
on logging level will only output what is needed for that level or
below. Additionally any private information (passwords, sensitive
information, etc.) is logged using a special private macro that is
only compiled in for internal builds.

-Shawn
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSLog on releasebuild

2008-07-23 Thread Dmitri Goutnik

On Jul 23, 2008, at 6:48 PM, Mike wrote:


Hello,

During development and debug I typically use tons of NSLog()- 
messages to get info what's happening.
I don't wish to include these messages to release-build so what is  
common/recommended way to get rid of them?


Should I comment them all out or is there some easier way to disable  
them or should I just leave them as they are?


Thanks.

-Mike


#ifndef DEBUG
#   define NSLog(...)
#endif


- Dmitri

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSLog on releasebuild

2008-07-23 Thread Mike

Thanks to all.

Seems like #ifndef xxx .   suites best for my needs which was my  
original solution. Just wished to ask if there is some switch  
somewhere in settings to toggle it on/off.
btw, is there any predefined var to determine debug/release -build so  
macro would work automatically? I recall that in MFC DEBUG was  
automatic defined - which doesn't seem to be so with Cocoa/xCode?



-Mike



Phillip Jacobs kirjoitti 23.7.2008 kello 18:33:

Is there anything particularly wrong with NSLog statements being in  
a release package? Performance wise? Security wise? Just wondering  
the root of the question.


Thanks,
-Phillip

On Jul 23, 2008, at 10:30 AM, Andrew Merenbach wrote:


Hi!

I think that you would want an @ symbol before the opening quote:

NSLog(@Whatever);

Cheers,
Andrew

On Jul 23, 2008, at 8:18 AM, Ian was here wrote:


Try this


#ifdef DEBUG
NSLog(Whatever);
#endif





--- On Wed, 7/23/08, Mike [EMAIL PROTECTED] wrote:


From: Mike [EMAIL PROTECTED]
Subject: NSLog on releasebuild
To: Cocoa-Dev List Cocoa-dev@lists.apple.com
Date: Wednesday, July 23, 2008, 7:48 AM
Hello,

During development and debug I typically use tons of
NSLog()-messages
to get info what's happening.
I don't wish to include these messages to release-build
so what is
common/recommended way to get rid of them?

Should I comment them all out or is there some easier way
to disable
them or should I just leave them as they are?

Thanks.

-Mike
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to
the list.
Contact the moderators at
cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/howlewere%40yahoo.com

This email sent to [EMAIL PROTECTED]




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/andrew.merenbach%40ucla.edu

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/pjacobs%40cosential.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/mike.mcfin 
%40gmail.com


This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSLog on releasebuild

2008-07-23 Thread Chris Backas
I agree with this. I like to leave my Console open most of the time,  
to monitor for potential software problems.  I really dislike  
applications that just spew endless nonsense there under even normal  
conditions.


Chris


On Jul 23, 2008, at 11:36 AM, Andrew Merenbach wrote:

I'd say that the most important reason for removing the NSLog()  
statements *might* be the look of the program.  Many users who use  
the Console probably wouldn't like it to become cluttered with  
detritus from spurious log statements.  It makes tech support more  
difficult if they need to look at their logs for something else, and  
may confuse the user -- What does ... mean??? Is something  
wrong?  Just a thought.


Cheers,
Andrew

On Jul 23, 2008, at 8:33 AM, Phillip Jacobs wrote:

Is there anything particularly wrong with NSLog statements being in  
a release package? Performance wise? Security wise? Just wondering  
the root of the question.


Thanks,
-Phillip

On Jul 23, 2008, at 10:30 AM, Andrew Merenbach wrote:


Hi!

I think that you would want an @ symbol before the opening quote:

NSLog(@Whatever);

Cheers,
Andrew

On Jul 23, 2008, at 8:18 AM, Ian was here wrote:


Try this


#ifdef DEBUG
NSLog(Whatever);
#endif





--- On Wed, 7/23/08, Mike [EMAIL PROTECTED] wrote:


From: Mike [EMAIL PROTECTED]
Subject: NSLog on releasebuild
To: Cocoa-Dev List Cocoa-dev@lists.apple.com
Date: Wednesday, July 23, 2008, 7:48 AM
Hello,

During development and debug I typically use tons of
NSLog()-messages
to get info what's happening.
I don't wish to include these messages to release-build
so what is
common/recommended way to get rid of them?

Should I comment them all out or is there some easier way
to disable
them or should I just leave them as they are?

Thanks.

-Mike
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to
the list.
Contact the moderators at
cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/howlewere%40yahoo.com

This email sent to [EMAIL PROTECTED]




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the  
list.

Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/andrew.merenbach%40ucla.edu

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/pjacobs%40cosential.com

This email sent to [EMAIL PROTECTED]




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/chb%40infoplusonline.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSLog on releasebuild

2008-07-23 Thread Nate Weaver
This is the route I follow. I use normal NSLog() statements for  
conditions that should never happen, and DebugLog() for debugging:


#ifdef DEBUG
#define DebugLog(s, ...) NSLog((@%s %s:%d  s), __func__,  
basename(__FILE__), __LINE__, ## __VA_ARGS__);

#else
#define DebugLog(s, ...)
#endif

The extra info is for context.

On Jul 23, 2008, at 11:22 AM, Shawn Erickson wrote:


On Wed, Jul 23, 2008 at 7:48 AM, Mike [EMAIL PROTECTED] wrote:

Hello,

During development and debug I typically use tons of NSLog()- 
messages to get

info what's happening.
I don't wish to include these messages to release-build so what is
common/recommended way to get rid of them?

Should I comment them all out or is there some easier way to  
disable them or

should I just leave them as they are?


In theory you could do something like the following (not tried this  
myself)...


#if defined(DEBUG) // or some other trigger for debug logging
#define DLog(...) NSLog( __VA_ARGS__ )
#else
#define DLog(...)
#endif

... then in code ...

DLog(@blah);
DLog(@blah %@, someObject);
etc.

-Shawn
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/nateweaver%40xtechllc.com

This email sent to [EMAIL PROTECTED]



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSLog on releasebuild

2008-07-23 Thread Timothy Reaves
 On Jul 23, 2008, at 6:48 PM, Mike wrote:

 Hello,

 During development and debug I typically use tons of NSLog()-
 messages to get info what's happening.
 I don't wish to include these messages to release-build so what is
 common/recommended way to get rid of them?

 Should I comment them all out or is there some easier way to disable
 them or should I just leave them as they are?

 Thanks.

 -Mike

 #ifndef DEBUG
 # define NSLog(...)
 #endif


 - Dmitri


Or simply use Log4Cocoa.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSLog on releasebuild

2008-07-23 Thread Gregory Weston

Andrew Merenbach wrote:


Is there anything particularly wrong with NSLog statements being in
a release package? Performance wise? Security wise? Just wondering
the root of the question.


I'd say that the most important reason for removing the NSLog()
statements *might* be the look of the program.  Many users who use the
Console probably wouldn't like it to become cluttered with detritus
from spurious log statements.  It makes tech support more difficult if
they need to look at their logs for something else, and may confuse
the user -- What does ... mean??? Is something wrong?  Just a
thought.


Heartily agree. NSLog output in a released program should be limited  
to reporting actual errors with whatever information is available at  
that time to locate and diagnose the problem. Any event that's out of  
the ordinary is fair game, not just errors. But (almost) any message  
that is essentially reporting that an operation worked as intended is  
noise.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSLog on releasebuild

2008-07-23 Thread Jean-Daniel Dupas
By carefull with the basename function. Theoricaly, it require a  
mutable string (char * and not const char *), so this logging function  
may crash (even it for now it works).


Le 23 juil. 08 à 20:01, Nate Weaver a écrit :

This is the route I follow. I use normal NSLog() statements for  
conditions that should never happen, and DebugLog() for debugging:


#ifdef DEBUG
#define DebugLog(s, ...) NSLog((@%s %s:%d  s), __func__,  
basename(__FILE__), __LINE__, ## __VA_ARGS__);

#else
#define DebugLog(s, ...)
#endif

The extra info is for context.

On Jul 23, 2008, at 11:22 AM, Shawn Erickson wrote:


On Wed, Jul 23, 2008 at 7:48 AM, Mike [EMAIL PROTECTED] wrote:

Hello,

During development and debug I typically use tons of NSLog()- 
messages to get

info what's happening.
I don't wish to include these messages to release-build so what is
common/recommended way to get rid of them?

Should I comment them all out or is there some easier way to  
disable them or

should I just leave them as they are?


In theory you could do something like the following (not tried this  
myself)...


#if defined(DEBUG) // or some other trigger for debug logging
#define DLog(...) NSLog( __VA_ARGS__ )
#else
#define DLog(...)
#endif

... then in code ...

DLog(@blah);
DLog(@blah %@, someObject);
etc.

-Shawn
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/nateweaver%40xtechllc.com

This email sent to [EMAIL PROTECTED]



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org

This email sent to [EMAIL PROTECTED]



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]