Simple log like system


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.