public function getLog() { if (!$this->_log instanceof Fuse_Log) { $log = new Fuse_Log(); $log->addWriter(new Fuse_LogDb('Model_ActivitySystem')); return $log; } return $this->_log; }
* @license Apache V2.0 * * THIS SOURCE CODE FORM IS SUBJECT TO THE TERMS OF THE PUBLIC * APACHE LICENSE V2.0. A COMPLETE COPY OF THE LICENSE TEXT IS * INCLUDED IN THE LICENSE FILE. * */ $di = new Fuse_Di(); $di['config'] = function () { $array = (include BF_PATH_ROOT . '/config.php'); return new Fuse_Config($array); }; $di['logger'] = function () use($di) { $logFile = $di['config']['path_logs']; $writer = new Fuse_LogStream($logFile); $log = new Fuse_Log(); $log->addWriter($writer); $log_to_db = isset($di['config']['log_to_db']) && $di['config']['log_to_db']; if ($log_to_db) { $activity_service = $di['mod_service']('activity'); $writer2 = new Fuse_LogDb($activity_service); if ($di['auth']->isAdminLoggedIn()) { $admin = $di['loggedin_admin']; $log->setEventItem('admin_id', $admin->id); } elseif ($di['auth']->isClientLoggedIn()) { $client = $di['loggedin_client']; $log->setEventItem('client_id', $client->id); } $log->addWriter($writer2); } return $log;