title: How to log all calls to a function in PHP? (mail() function)
body: <p>I have a dedicated server with tens of virtual hosts. I want to determine what file is calling mail() function and log this globally. I need something like that:</p>
  
  <pre><code>[Wed Feb 13 10:42:39 2013] mail() called from /var/www/example1.php on line 70
  [Wed Feb 13 10:42:40 2013] mail() called from /var/www/example2.php on line 70
  </code></pre>
  
  <p>I can't use debug_backtrace() or similar because I can't add this to any PHP file in the server. Can I log all function calls globally in a file like errors are logged to a file like error.log?</p>
  
  <p>Thanks</p>