mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-10-22 19:24:34 -04:00
Amélioration vitesse lecture des logs
This commit is contained in:
1 parent
bff31a6d5e
commit
803cd05a58
1 file changed
+8
-9
@@ -29,19 +29,18 @@ class LogDAO extends Model_txt {
|
||||
public function __construct () {
|
||||
parent::__construct (LOG_PATH . '/application.log', 'r+');
|
||||
}
|
||||
|
||||
|
||||
public function lister () {
|
||||
$logs = array ();
|
||||
|
||||
$i = 0;
|
||||
while (($line = $this->readLine ()) !== false) {
|
||||
$logs[$i] = new Log_Model ();
|
||||
$logs[$i]->_date (preg_replace ("'\[(.*?)\] \[(.*?)\] --- (.*?)'U", "\\1", $line));
|
||||
$logs[$i]->_level (preg_replace ("'\[(.*?)\] \[(.*?)\] --- (.*?)'U", "\\2", $line));
|
||||
$logs[$i]->_info (preg_replace ("'\[(.*?)\] \[(.*?)\] --- (.*?)'U", "\\3", $line));
|
||||
$i++;
|
||||
if (preg_match ('/^\[([^\[]+)\] \[([^\[]+)\] --- (.*)$/', $line, $matches)) {
|
||||
$myLog = new Log_Model ();
|
||||
$myLog->_date ($matches[1]);
|
||||
$myLog->_level ($matches[2]);
|
||||
$myLog->_info ($matches[3]);
|
||||
$logs[] = $myLog;
|
||||
}
|
||||
}
|
||||
|
||||
return $logs;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user