Say I have 10 different implementation files that are run in an chaotic order, and in each of them I have an NSLog(@"Log");
, and when I run the program I will get 10 Log
's to my console output, but how can I know which one was logged by which file? I'm searching for something like
`In someFile1.m: Log`
`In someFile3.m: Log`
`In someFile2.m: Log`
`...`
And so on and so forth. Is that possible?
You can use preprocessor macros for that, take a look at this example:
NSLog(@"In %s - %s:%d someObject=%@", __FILE__, __func__, __LINE__, someObject);
Here's what's available: https://developer.apple.com/library/ios/qa/qa1669/_index.html