title: Redirect print to a File like redirecting NSLog to a file
body: <p>I have redirected <em>NSLog</em> to a <em>file</em> using the macros.</p>
  
  <p>But I couldn't find a stable way in swift to do that.</p>
  
  <p>As of now I am doing a workaround</p>
  
  <p>I define the following method so whenever I call print in the file it comes here and I write that to a file.</p>
  
  <pre><code>func print(log:String!) {
          if let logg = log {
              DeveloperConsoleManager.sharedInstance.writeOnConsoleLog(logg)
          }
      }
  </code></pre>
  
  <p>But problems with this approach are </p>
  
  <p>1.I will get <strong>Extra Argument in Call</strong>
  If I do like below</p>
  
  <pre><code>print("some comments",Obj1,Obj2)
  </code></pre>
  
  <p>so I have to use like this </p>
  
  <pre><code>print("some comments \(Obj1) \(Obj2)")
  </code></pre>
  
  <p>2.I will get error like <strong>Cannot convert value of type '[AnyObject]' to expected argument type 'String!'</strong> If I try to print an object directly</p>
  
  <pre><code>print(obj)
  </code></pre>
  
  <p>so I have to call the description method of the object</p>
  
  <pre><code>print(obj.description)
  </code></pre>
  
  <p>3.<em>I have to include the function definition that I have quoted above wherever I want this functionality But in the case of NSLog its globally defined in one place</em></p>
  
  <p>so Now I am looking for a stable solution to <em>redirect the contents of <strong>print</strong> in swift to a file</em></p>
  
  <p>so I can use <strong><em>print</em></strong> as I do normally in swift</p>
  
  <p><em>Update:</em></p>
  
  <p>I tried overriding the print but I got  <strong>Method does not override any method from its superclass</strong></p>