title: NSLog the method name with Objective-C in iPhone
body: <p>Currently, we are defining ourselves an extended log mechanism to print out the class name and the source line number of the log. </p>
  
  <pre><code>#define NCLog(s, ...) NSLog(@"&lt;%@:%d&gt; %@", [[NSString stringWithUTF8String:__FILE__] lastPathComponent], \
      __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__])
  </code></pre>
  
  <p>For example, when I call NCLog(@"Hello world");
  The output will be:</p>
  
  <pre><code>&lt;ApplicationDelegate:10&gt;Hello world
  </code></pre>
  
  <p>Now I also want to log out the method name like:</p>
  
  <pre><code>&lt;ApplicationDelegate:applicationDidFinishLaunching:10&gt;Hello world
  </code></pre>
  
  <p>So, this would make our debugging become easier when we can know which method is getting called. I know that we also have Xcode debugger but sometimes, I also want to do debugging by logging out.</p>