Skip to content

Instantly share code, notes, and snippets.

@mfazekas
Created May 3, 2009 19:39
Show Gist options
  • Save mfazekas/106127 to your computer and use it in GitHub Desktop.
Save mfazekas/106127 to your computer and use it in GitHub Desktop.
@interface LoggerProxy : NSObject
{
id original;
}
- (id)initWithOriginal:(id) value;
@end
@implementation LoggerProxy
- (id) initWithOriginal:(id)value
{
if (self = [super init]) {
original = value;
}
return self;
}
- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel
{
NSMethodSignature *sig = [super methodSignatureForSelector:sel];
if(!sig)
{
sig = [original methodSignatureForSelector:sel];
}
return sig;
}
- (void)forwardInvocation:(NSInvocation *)inv
{
NSLog(@"[%@ %@] %@ %@", original, inv,[inv methodSignature],
NSStringFromSelector([inv selector]));
[inv invokeWithTarget:original];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment