/** * Return the list of events * * @param $fromTime string The start time in date format Y-m-d H:i:s * @param $order string The order for getting events : DESC or ASC * @param $limit int The number of event to get * @param $filters array The list of fitlers for event * @return array */ public static function getEventLogs($fromTime = null, $order = 'DESC', $limit = null, $filters = array()) { $di = Di::getDefault(); /* If time is a timestamp, convert it */ if (!is_null($fromTime) && is_numeric($fromTime)) { $fromTime = date('Y-m-d H:i:s', $fromTime); } /* Get configuration */ $storageType = $di->get('config')->get('default', 'eventlogs', 'database'); if ($storageType == 'database') { return EventLogDatabase::getEventLogs($fromTime, $order, $limit, $filters); } elseif ($storageType == 'elasticsearch') { return ElasticSearch::getEventLogs($fromTime, $order, $limit, $filters); } throw new \Exception("The eventlogs storage does not exists"); }