title: Custom NSLog Method ( Variadic )
body: <p>I am trying to create a custom <code>NSLog()</code> method , <code>DNSLog()</code> , which executes the <code>NSLog</code> only if the debug variable is true.</p>
  
  <pre><code>-(void)DNSLog:(NSString *)formatString, ...
  {
      if(debug){
          va_list args;
          va_start(args, formatString);
          NSLog([[NSString alloc] initWithFormat:formatString arguments:args]);
          va_end(args);
      }
  }
  </code></pre>
  
  <p>But when I try calling it using </p>
  
  <pre><code>DNSLog(@"Hello %d",x);
  </code></pre>
  
  <p>I receive a compilation error :</p>
  
  <pre><code>Undefined symbols for architecture i386:
    "_DZNSLog", referenced from:
        -[RestaurantInfoViewController viewDidLoad] in RestaurantInfoViewController.o
  ld: symbol(s) not found for architecture i386
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p>I have used this as a reference : <a href="http://www.cocoawithlove.com/2009/05/variable-argument-lists-in-cocoa.html">http://www.cocoawithlove.com/2009/05/variable-argument-lists-in-cocoa.html</a></p>
  
  <p>Where am I going wrong ?</p>