public function testLoggingMethods() { Logger::emergency("Test logger!"); Logger::alert("Test logger!"); Logger::critical("Test logger!"); Logger::error("Test logger!"); Logger::warning("Test logger!"); Logger::notice("Test logger!"); Logger::info("Test logger!"); Logger::debug("Test logger!"); $this->assertStringEqualsFile(vfsStream::url("logs/file.log"), $this->log); }
private function startDaemon($options) { $pid = pcntl_fork(); if ($pid == -1) { Logger::error("Sorry! could not start daemon.\n"); } else { if ($pid) { Logger::info("Daemon started with pid {$pid}.\n"); $pidFile = Config::get('ajumamoro:pid_file', './ajumamoro.pid'); file_put_contents($pidFile, $pid); } else { Runner::mainLoop($options); } } return $pid; }
public static function getNextJob() { $broker = Broker::getInstance(); $jobInfo = $broker->get(); if (file_exists($jobInfo['path'])) { require_once $jobInfo['path']; } if (!class_exists($jobInfo['class'])) { Logger::error("Class {$jobInfo['class']} for scheduled job not found"); return false; } $job = unserialize($jobInfo['object']); if (is_object($job) && is_a($job, '\\ajumamoro\\Job')) { $job->setId($jobInfo['id']); return $job; } else { Logger::error("Scheduled job is not of type \\ajumamoro\\Job."); return false; } }