NSLog()
NSLog() action from the Action Menu or Action Panel will take your ivars or properties and create logging statements for you that include the method where the log is being called from. You can insert these logs into any method, or create a method that calls all the logs. Of course, you can also use the Generate for key paths action get at your values in a different way.
Example: let’s say you have these ivars.
@interface NeuralCenter : NSObject {
NSString *name;
float freq;
NSArray *songs;
NSMutableArray *artists;
BOOL fast;
}
Invoke the Accessorizer Action Panel service (see Setup) then bring up the Action Menu or Action Panel and type “r” or the NSLog() menu.
NSLog(@"%s: returned self.name = %@", __FUNCTION__, self.name);
NSLog(@"%s: returned self.freq = %f", __FUNCTION__, self.freq);
NSLog(@"%s: returned self.songs = %@", __FUNCTION__, self.songs);
NSLog(@"%s: returned self.artists = %@", __FUNCTION__, self.artists);
NSLog(@"%s: returned self.fast = %@", __FUNCTION__, self.fast ? @"YES": @"NO" );
You can also turn on NSLog() in the main Accessorizer interface Accessor Style TAB
Doing so will insert an NSLog() statement in your 1.0 explicit accessors.
- (NSString *)name {
//NSLog(@"%s: returned _name = %@", __FUNCTION__, _name);
return [[_name retain] autorelease];
}
- (void)setName:(NSString *)newName {
if (_name != newName) {
//NSLog(@"%s: old value of _name: %@, changed to: %@", __FUNCTION__, _name, newName);
[_name release];
_name = [newName copy];
}
}