Sunday, May 01, 2011

Logging with function Name in Objective-C

sometimes i need to log output or operations happening in my Programs.
And most of the time i want to know the function responsible for this  output that is being logged. i Used to do it manually but recently found a cool way to do it.
Inside your function just write the following to perform logging
NSLog(@"Logging from %s",__FUNCTION__);

The output will look like:
Logging from [TestViewController testFunction:];
that's simple Genius :)

if you like it , share it using one of the options below
  ⃔

0 comments: