public function __construct() { parent::__construct(); $config_class = \PHPQueue\Base::$config_class; $config = $config_class::getConfig($this->queue_type); $this->dataSource = \PHPQueue\Base::backendFactory($config['backend'], $config); $this->resultLog = \PHPQueue\Logger::createLogger('MainLogger', \PHPQueue\Logger::INFO, sprintf('%s/QueueLog-%s-%s.log', $config_class::getLogRoot(), $this->queue_type, date('Ymd'))); }
protected function processWorker($worker_name, $new_job) { $this->logger->addInfo(sprintf("Running new job (%s) with worker: %s", $new_job->job_id, $worker_name)); $worker = Base::getWorker($worker_name); Base::workJob($worker, $new_job); $this->logger->addInfo(sprintf('Worker is done. Updating job (%s). Result:', $new_job->job_id), $worker->result_data); return $worker->result_data; }
public function setup() { if (empty($this->log_path)) { $baseFolder = dirname(dirname(__DIR__)); $this->log_path = sprintf('%s/demo/runners/logs/', $baseFolder); } $logFileName = sprintf('%s-%s.log', $this->queue_name, date('Ymd')); $this->logger = \PHPQueue\Logger::createLogger($this->queue_name, $this->log_level, $this->log_path . $logFileName); }
public function __construct() { $this->dataSource = \PHPQueue\Base::backendFactory('Beanstalkd', $this->sourceConfig); $this->resultLog = \PHPQueue\Logger::createLogger('BeanstalkSampleLogger', PHPQueue\Logger::INFO, __DIR__ . '/logs/results.log'); }
protected function createLogger() { $this->logger = Logger::createLogger($this->queue_name, $this->log_level, $this->getFullLogPath()); }