Skip navigation.
 
mlRe: NSLog every selector on an object?
FROM : Carlos Salinas
DATE : Mon May 12 18:08:16 2008

I have an NSProxy subclass that logs the methods sent to a target 
object.

I use the class to test my code. I log the methods into an array. I 
then compare that array of strings with an expected array of strings. 
This is useful for verifying that messages between layers and 
delegates are occuring and in the right order.





Call -setExcludedMethods: to specify the methods that are not to be 
logged. Here's a usage example:

    // Replace the view with a TestProxy that logs the methods sent 
to the view.

    id documentView = [scrollView documentView];
    id documentViewProxy = [[TestProxy alloc] 
initWithTarget:documentView];

    // Set the methods that are not logged.

    NSSet *excludedMethods = [NSSet setWithObjects:
   @"hitTest:",        // Too many of these. Ignore.
   @"toolTip",
   @"inLiveResize",
   nil
    ];

    [documentViewProxy setExcludedMethods:excludedMethods];



'Los
<email_removed>

On May 9, 2008, at 8:44 PM, Matt James wrote:

> Is there any way to overload a class in such a manner as to print 
> out every
> method call it makes at any given time before it runs the method? 
> Right
> now, I'm overloading a few methods of this particular class and 
> putting
> NSLog's at the first line, but I was wondering if there was a way to 
> jump in
> before _ALL_ methods on an object and perform this particular task.
> Thanks for any help!
>
> -Matt
> _______________________________________________
> MacOSX-dev mailing list
> <email_removed>
> http://www.omnigroup.com/mailman/listinfo/macosx-dev

Related mailsAuthorDate
mlNSLog every selector on an object? Matt James May 10, 05:44
mlRe: NSLog every selector on an object? Christiaan Hofman May 10, 13:11
mlRe: NSLog every selector on an object? Jonathon Mah May 10, 15:49
mlRe: NSLog every selector on an object? objectwerks inc May 10, 18:32
mlRe: NSLog every selector on an object? Bill Bumgarner May 10, 19:48
mlRe: NSLog every selector on an object? Gerd Knops May 10, 20:34
mlRe: NSLog every selector on an object? Scott Little May 10, 23:34
mlRe: NSLog every selector on an object? Stéphane Corthésy May 11, 11:53
mlRe: NSLog every selector on an object? Matt James May 11, 15:33
mlRe: NSLog every selector on an object? objectwerks inc May 12, 01:45
mlRe: NSLog every selector on an object? Scott Little May 12, 13:02
mlRe: NSLog every selector on an object? Carlos Salinas May 12, 18:08