• 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: Comparing Run Logs?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Comparing Run Logs?


  • Subject: Re: Comparing Run Logs?
  • From: email@hidden
  • Date: Wed, 7 Mar 2007 16:21:40 -0700

Hi Andy,

Thanks for the suggestion. I don't understand enough simple C to grasp your approach, but I ended up preceding each NSLog with a BOOL function because I need the flexibility to create more Log Codes in the future, possibly change the response to them dynamically, and possibly select for messages only in a specific thread. I may need to change my approach in the future if efficiency becomes a concern.

I've not found my bug yet, but I can see that thread execution is wildly random between instances.

DC

On Mar 7, 2007, at 3:25 PM, Andy Lee wrote:

On Mar 7, 2007, at 4:59 PM, email@hidden wrote:
void MYLog(enum LogCode lc, NSString *format, ...) {
	// NSLog(format, ...);
}

I forget why (probably a trivial efficiency thing), but I do it with a macro rather than a function. If I understand your intentions, I'd do it with three separate macros rather than pass a LogCode as an argument, something like this:


#define MYLogAny(format, ...)\
    NSLog(\
        [@"[MYLogAny] " stringByAppendingString:(format)],\
        ## __VA_ARGS__);

#define MYLogOther(format, ...)\
    NSLog(\
        [@"[MYLogOther] " stringByAppendingString:(format)],\
        ## __VA_ARGS__);

#define MYLogThreadState(format, ...)\
    NSLog(\
        [@"[MYLogThreadState] " stringByAppendingString:(format)],\
        ## __VA_ARGS__);

I have a similar set of macros, except it's one for each level of log verbosity (DEBUG, INFO, WARN, etc.). Feel free to grab my source: http://homepage.mac.com/aglee/downloads/AppKiDo-0.962- src.tgz. The NSLog-wrapping stuff is in DIGSLog.h and DIGSLog.m.

--Andy


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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)

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


References: 
 >Comparing Run Logs? (From: email@hidden)
 >Re: Comparing Run Logs? (From: email@hidden)
 >Re: Comparing Run Logs? (From: Andy Lee <email@hidden>)

  • Prev by Date: Unbinding NSArrayController's contentArray
  • Next by Date: Re: Unbinding NSArrayController's contentArray
  • Previous by thread: Re: Comparing Run Logs?
  • Next by thread: Re: Comparing Run Logs?
  • Index(es):
    • Date
    • Thread