public function testLog() { $l = new Logger(new File(__DIR__ . '/../tmp/app.log')); $l->log(Logger::EMERG, 'Test log message'); $this->assertTrue(file_exists(__DIR__ . '/../tmp/app.log')); $this->assertGreaterThan(0, filesize(__DIR__ . '/../tmp/app.log')); unlink(__DIR__ . '/../tmp/app.log'); }
/** * Log the project. * * @param string $message * @param int $time * @param int $priority * @return void */ public function log($message, $time = null, $priority = \Pop\Log\Logger::INFO) { if (null !== $this->logger) { if (null !== $time) { $end = stripos($message, 'send') === false && (stripos($message, 'kill') !== false || stripos($message, 'end') !== false) ? PHP_EOL : null; $message = "[" . ($time - $this->start) . " seconds]\t\t" . $message . $end; } $this->logger->log($priority, $message); } }