• 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() replacement for debugger output
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSLog() replacement for debugger output


  • Subject: Re: NSLog() replacement for debugger output
  • From: Mohsan Khan <email@hidden>
  • Date: Fri, 25 Apr 2008 00:20:58 +0200

Sorry, I was a little bit to quick there...

I get an error

169: DBOut( @"Hello World!" );
/AppController.m:169: error: syntax error before ']' token

Did I miss something?




On to 24 apr 2008, at 23.24, Mohsan Khan wrote:

Ohh this is so good, I'm happy!!!

Thanks!



On to 24 apr 2008, at 21.53, Don Arnel wrote:

I thought I'd share this with those of you who want an alternative to NSLog(). If you want your debugging output to always go to the debugger console without all the date and time stamping info, just place this bit of code in your <AppName>_Prefix.pch file. Then define the __DEBUG_OUT__ preprocessor macro in your Project Settings for Debug builds.

Once you have done this, debug output only occurs for debug builds. For release builds, it's as if the debug output code never existed.

Usage:

For NSString-style output use DBOut() the same way you would use NSLog().
For char *string output use DBCOut()


Enjoy!
- Don

#ifdef __DEBUG_OUT__
#define DBOut(fmt, ...) fprintf(stderr, "%s\n", [[NSString stringWithFormat:(fmt), __VA_ARGS__] cStringUsingEncoding:NSUTF8StringEncoding])
#define DBCOut(fmt, ...) fprintf(stderr, fmt, __VA_ARGS__)
#else
#define DBOut(fmt, ...)
#define DBCOut(fmt, ...)
#endif
_______________________________________________


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:
@bredband.net


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() replacement for debugger output
      • From: Don Arnel <email@hidden>
    • Re: NSLog() replacement for debugger output
      • From: Ken Thomases <email@hidden>
References: 
 >NSLog() replacement for debugger output (From: Don Arnel <email@hidden>)
 >Re: NSLog() replacement for debugger output (From: Mohsan Khan <email@hidden>)

  • Prev by Date: Re: SOLVED ?? Re: Application Launch (or doesn't Launch as such)
  • Next by Date: Re: Obj-C client and Java-RMI server
  • Previous by thread: Re: NSLog() replacement for debugger output
  • Next by thread: Re: NSLog() replacement for debugger output
  • Index(es):
    • Date
    • Thread