• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSLog on releasebuild
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSLog on releasebuild


  • Subject: Re: NSLog on releasebuild
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Thu, 24 Jul 2008 01:24:37 +0200

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@hidden> 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 (email@hidden)

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:
This email sent to email@hidden


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSLog on releasebuild
      • From: Nate Weaver <email@hidden>
References: 
 >NSTask (From: Torsten Curdt <email@hidden>)
 >Re: NSTask (From: Michael Watson <email@hidden>)
 >NSLog on releasebuild (From: Mike <email@hidden>)
 >Re: NSLog on releasebuild (From: "Shawn Erickson" <email@hidden>)
 >Re: NSLog on releasebuild (From: Nate Weaver <email@hidden>)

  • Prev by Date: Re: First Responder, NSUndoManager, and MyDocument
  • Next by Date: Re: Spotlight and NSPredicate
  • Previous by thread: Re: NSLog on releasebuild
  • Next by thread: Re: NSLog on releasebuild
  • Index(es):
    • Date
    • Thread