title: NSLog inside variable arguments function
body: <p>I do not have clear idea about objective c variable argument function. I want to write a function which will take a nlsog type parameter but sometime I shall use NSLog inside that function. How can I do that? </p>
  
  <pre><code>-(void) printStatus:(NSString*)status, ...
  {
      // I want use use NSLog with all these parameter here.
  
      // some gui logging also happens here
  }
  </code></pre>
  
  <p>Calls will be like this,</p>
  
  <pre><code>[self printStatus:@"status"]; 
  </code></pre>
  
  <p>or </p>
  
  <pre><code>[self printStatus:@"Staus: %@", someObject];
  </code></pre>
  
  <p>Instead of using NSLog, I want to use printStatus. When I need to switch the console logging to a GUI logging, I can do it only changing to the printStatus function, not changing all places inside my code. </p>
  
  <p>Or use DLog as I am using here,</p>
  
  <pre><code>#ifdef DEBUG
  #   define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
  #else
  #    define DLog(...) /* */
  #endif
  </code></pre>