Posted By

Zver on 11/18/08


Tagged

linux log system tail


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

Nix
clac


Simple log like system


 / Published in: PHP
 

  1. <?php
  2.  
  3.  
  4. function wlog($m=""){
  5. $myFile = "/tmp/shib.log"; #log path
  6. $fh = fopen($myFile, 'a') or die("can't open file");
  7. $stringData = $m."\n";
  8.  
  9. if($m==""){$stringData = "\n";};
  10. fwrite($fh, $stringData);
  11. fclose($fh);
  12. };
  13.  
  14.  
  15. /* Usage :
  16.  
  17. wlog("Write this to log...");
  18. wlog();
  19. wlog("New line...");
  20.  
  21. ----
  22.  
  23. System usage:
  24.  
  25. tail -f /tmp/shib.log
  26.  
  27.  
  28.  
  29. */
  30.  
  31. ?>

Report this snippet  

You need to login to post a comment.