Created
July 17, 2020 12:52
-
-
Save rolandkakonyi/3c43f6e0317b0e533664273bc76818ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define PRINT_CALLER(cmd, arg) ({ \ | |
NSString *sourceString = [[NSThread callStackSymbols] objectAtIndex:1]; \ | |
NSCharacterSet *separatorSet = [NSCharacterSet characterSetWithCharactersInString:@" -[]+?.,"]; \ | |
NSMutableArray *array = [NSMutableArray arrayWithArray:[sourceString componentsSeparatedByCharactersInSet:separatorSet]]; \ | |
[array removeObject:@""]; \ | |
NSString *value = arg == nil ? @"nil" : [NSString stringWithFormat:@"%@", (arg)]; \ | |
NSLog(@"Caller of '%@' is '[%@ %@]', with argument: '%@'", NSStringFromSelector(cmd), [array objectAtIndex:3], [array objectAtIndex:4], value); \ | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment