Posted By

davidlukerice on 12/14/12


file debug log write

Versions (?)

Debug log to File

 / Published in: PHP

Also tries to log with elgg (Used when testing elgg plugins). Just remove the or elgg_log(...) if not using it.

  1. function file_log($msg)
  2. {
  3. $myFile = "testLogFile.txt";
  4. $fh = fopen($myFile, 'a') or elgg_log("can't open file", 'ERROR');
  5. $stringData = date('Y.m.d H:i:s: ').$msg."\n";
  6. fwrite($fh, $stringData);
  7. fclose($fh);
  8. }

Report this snippet  

You need to login to post a comment.