Exemple #1
0
 public function test()
 {
     $logFixtureFile = 'tests/fixtures/log-line.fixture';
     $logFixture = file_get_contents($logFixtureFile);
     $logToStringFixtureFile = 'tests/fixtures/log-line-to-string.fixture';
     $logToStringFixture = file_get_contents($logToStringFixtureFile);
     $line = Line::parseLine($logFixture);
     $toString = (string) $line;
     static::assertEquals($logToStringFixture, $toString);
     $line = new Line('2015-01-20 00:00:01', 'debug', 'testMessage');
     $toString = (string) $line;
     static::assertEquals('2015-01-20 00:00:01 debug testMessage', $toString);
 }
Exemple #2
0
 public static function parseLog($log)
 {
     $lines = explode("\n", $log);
     $start = self::cleanStartLine(array_shift($lines));
     array_shift($lines);
     //$end = array_pop($lines);
     $duration = self::cleanStartLine(array_pop($lines));
     $retrieved = self::cleanStartLine(array_pop($lines));
     array_pop($lines);
     $console = new Console($start, $duration, $retrieved);
     foreach ($lines as $line) {
         $console->addLine(Line::parseLine($line));
     }
     return $console;
 }