LogDAO.php 518 B

1234567891011121314151617181920
  1. <?php
  2. class FreshRSS_LogDAO extends Minz_ModelTxt {
  3. public function __construct () {
  4. parent::__construct (LOG_PATH . '/application.log', 'r+');
  5. }
  6. public function lister () {
  7. $logs = array ();
  8. while (($line = $this->readLine ()) !== false) {
  9. if (preg_match ('/^\[([^\[]+)\] \[([^\[]+)\] --- (.*)$/', $line, $matches)) {
  10. $myLog = new FreshRSS_Log ();
  11. $myLog->_date ($matches[1]);
  12. $myLog->_level ($matches[2]);
  13. $myLog->_info ($matches[3]);
  14. $logs[] = $myLog;
  15. }
  16. }
  17. return $logs;
  18. }
  19. }