Same question as: Do __LINE__ __FILE__ equivalents exist in C#?
But for Objective-C in iPad/iPhone SDK Xcode? This would really help my NSLog statement be a lot more readable over time.
So even easier visually. Displays only the file name without a path. It is convenient to observe the terminal without text wrapping.
Writing:
NSLog(@"Log: %s %d", (strrchr(__FILE__, '/') ?: __FILE__ - 1) + 1, __LINE__);
Output is:
Log: file.m 340
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With