php - Simplest way of outputting debug content into file -


I have got an idiotone with various php scripts. I want to get an idea of ​​how much time it takes to move performance from point to point. (There are many such points).

I was looking for a simple PHP line which I can insert without modification on different places in my code, and get an output file (not generated HTML) which looks like this: / P>

  file name function LINENUMBER TIMESTAMP  

We have started using it:

  file_put_contents ('/ home / Default / public_html / debug.log ', __FILE__. "\ T" .___ __FUNCTION__. "\ T" .___LINE__. "\ T" Microtom (true). "\ N", FILE_APPEND);  

Which is good, but what are the better ways to do this?

For an easy way of doing this, you can either trigger_error () And E_NOTICE level, or error_log. function in a separate file.

I will suggest another solution to your case.


trigger_error () :

  & lt ;? Php trigger_error ("The call will now start", E_NOTICE); StartTheHugeCall (); Trigger_error ("The call is finished", E_NOTICE); ? & Gt;   : 

  & lt ;? With php error_log ("call will now start", 3, " 

/var/tmp/debugfile.log"); StartTheHugeCall (); Error_log ("The call is finished", 3, "/var/tmp/debugfile.log"); ? & Gt;

  • >

    Comments