PageRenderTime 59ms CodeModel.GetById 28ms RepoModel.GetById 1ms app.codeStats 0ms

/README.md

https://github.com/rogeriopvl/phplogtailer
Markdown | 29 lines | 20 code | 9 blank | 0 comment | 0 complexity | 3730704ad316e330aa69a8108b5b897f MD5 | raw file
  1. # PHP Log Tailer
  2. ## Description
  3. phplogtailer is a PHP5 library that tails a given log file, allowing to attach an event every time a new line is written into the log file.
  4. ## Installation
  5. Just place the files wherever you prefer, and require them in your code.
  6. ## Usage examples
  7. <?php
  8. require_once('LogTailer.php');
  9. require_once('LogTailerListener.php');
  10. class MyListener implements LogTailerListener {
  11. public function newLineAdded($line) {
  12. echo "New line on log file: $line";
  13. }
  14. }
  15. $tailer = new LogTailer('/var/log/apache/access.log');
  16. $listener = new MyListener();
  17. $tailer->addListener($listener);
  18. $tailer->start();
  19. // when we're done we can stop the tailing process
  20. $tailer->stop();