Hi all, I'm having trouble figuring this out.

I have a logging function thus:

        void    GCLogObjCMethod( id obj, SEL selector, NSUInteger lineNumber, 
NSString* tag, NSString* format, ... );

I'd like to be able to wrap this using a macro that automatically supplies the 
object, selector, line number and 'tag' (which is usually the class name of the 
object) and leaves only the format and the variable arguments to be supplied. I 
haven't been able to come up with a way that works. Can it be done? i.e. what I 
want is a macro:

GCLOGOC( @"this is a format string: %@, with any number of params: %@", paramA, 
paramB );

and this expands to:

GCLogObjCMethod( self, _cmd, __LINE__, NSStringFromClass([self class]), @"this 
is a format string: %@, with any number of params: %@", paramA, paramB );

(or expands to nothing at all if logging has been turned off).

How can I define the macro so it can handle the variable parameter list?

--Graham


_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to