| 
	
 | 
 Posted by AnrDaemon on 06/16/84 12:00 
Greetings, Hanoi. 
In reply to Your message dated Monday, January 7, 2008, 11:36:10, 
 
> I would like to have a php file that log informations sent by an image 
> request. 
 
> For logging, I use fwrite to write on a file. 
 
For the logging purposes (considering there is not much of data sent to log) 
I'm using this filter function: 
 
function ob_debugfilter($str) 
{ 
  $str = date('Y-m-d H:i:s') . " {$str}\n"; 
 
  if(defined('toolDebugFilterTarget') && toolDebugFilterTarget) 
  { 
    error_log($str, 3, toolDebugFilterTarget); 
    $str = NULL; 
  } 
 
  return $str; 
} 
 
To initialize it, You should define a constant toolDebugFilterTarget with the 
path to Your logfile and start output buffering in Your code. 
Don't forget to use ob_flush(); at each point of log output, itherwise all 
Your log output from single run will be written in a single line. 
 
I.e. 
 
  var_export($rc); @ob_flush(); 
 
 
--  
Sincerely Yours, AnrDaemon <anrdaemon@freemail.ru>
 
  
Navigation:
[Reply to this message] 
 |