Return the legacy event log data.

@return array|null
551055
protected function get_legacy_logdata() {
        global $CFG;
        $service = $this->get_record_snapshot('external_services', $this->objectid);
        return array(SITEID, 'webservice', 'add', $CFG->wwwroot . "/" . $CFG->admin . "/settings.php?section=externalservices",
            get_string('addservice', 'webservice', $service));
    }
278555
public function getData()
    {
        if (!$this->enabled()) {
            return null;
        }

        $this->addDeprecations();
        $this->timers = [];

        return $this->debugbar->getData();
    }
851060
protected function get_legacy_logdata() {
        $log1 = array($this->courseid, "course", "update mod", "../mod/" . $this->other['modulename'] . "/view.php?id=" .
                $this->objectid, $this->other['modulename'] . " " . $this->other['instanceid']);
        $log2 = array($this->courseid, $this->other['modulename'], "update",
               "view.php?id={$this->objectid}",
               "{$this->other['instanceid']}", $this->objectid);
        return array($log1, $log2);
    }
250583
public function getEventLog(Event $event, $eventName)
    {
        $eventLog = $this->getEventLogObject($this->getEventLogInfo($event, $eventName));

        if (null === $eventLog) {
            return null;
        }

        $eventLog->setTypeId($eventName);
        $eventLog->setIp($this->getClientIp());
        $eventLog->setEventTime(new \DateTime());
        $this->setUser($eventLog);

        return $eventLog;
    }
508917
protected function get_legacy_eventdata() {
        global $USER;

        $workshop = $this->get_record_snapshot('workshop', $this->objectid);
        $course   = $this->get_record_snapshot('course', $this->courseid);
        $cm       = $this->get_record_snapshot('course_modules', $this->contextinstanceid);
        $workshop = new \workshop($workshop, $cm, $course);
        return (object)array('workshop' => $workshop, 'user' => $USER);
    }
419907
protected function get_legacy_logdata() {
        $lesson = $this->get_record_snapshot('lesson', $this->other['lessonid']);
        return array($this->courseid, 'lesson', 'update grade', 'essay.php?id=' .
                $this->contextinstanceid, $lesson->name, $this->contextinstanceid);
    }
191310
public function getLogs()
    {
        $realpath = (string) $this->getLogsRealpath();
        if (!$realpath) {
            return [];
        }

        $logs = trim($this->files->read($realpath));
        $logs = explode(PHP_EOL, $logs);

        return $logs;
    }
244587
final public function getEventListForAjax() {

		$app		= Application::getInstance();
		$router		= Router::getInstance();
		
		if (!$this->isEnabled() or !$router->sendLog()) {
			return NULL;
		}
		
		$log = '';

		// shows the log
		if (Options::get('show_log') and $app->currentUser->admin) {
		
			$showQueries = isset($_COOKIE['LogShowQueries']) ? $_COOKIE['LogShowQueries'] : 0;
			
			foreach ($this->events as $e) {
			
				// if it's query, verifies cookie val
				$class = $e->type . (('query'==$e->type and !$showQueries) ? ' hidden' : '');
				
				$log .=
					'<div class="' . $class . '"><span class="time">' .
					$this->formatChrono($e->chrono) . '</span> ' . htmlspecialchars($e->description) .
					($e->subtext ? ' <span>| ' . htmlspecialchars($e->subtext) . '</span>' : '') . '</div>';
				
			}
			
		}
		
		return $log;
		
	}
257270
protected function get_legacy_logdata() {
        $user = $this->get_record_snapshot('user', $this->relateduserid);
        $logmessage = get_string('unlocksubmissionforstudent', 'assign', array('id' => $user->id, 'fullname' => fullname($user)));
        $this->set_legacy_logdata('unlock submission', $logmessage);
        return parent::get_legacy_logdata();
    }
1076988
protected function get_legacy_logdata() {
        $params = array();
        foreach ($this->validparams as $param) {
            if (!empty($this->other[$param])) {
                $params[$param] = $this->other[$param];
            }
        }
        $url = new \moodle_url('index.php', $params);
        return array (SITEID, 'blog', 'view', $url->out(), 'view blog entry');
    }
326996
public function getHistory(): array
    {
        $history = [];
        foreach ($this->xml->History->children() as $logEntry) {
            $log = [];
            foreach ($logEntry as $key => $val) {
                $log[lcfirst($key)] = (string) $val;
            }
            $history[] = $log;
        }

        return $history;
    }
799547
protected function get_legacy_eventdata() {
        $data = new \stdClass();
        $data->cohortid = $this->objectid;
        $data->userid = $this->relateduserid;
        return $data;
    }
65512
final public function getEventList() {

		$app = Application::getInstance();
		$router = Router::getInstance();
		
		if (!$this->isEnabled()) {
			return NULL;
		}
		
		$sum			= 0;
		$log			= '';

		$apiChrono		= 0;
		$queryChrono	= 0;
		$queryCount		= 0;
		$warningCount	= 0;
		$errorCount		= 0;
		
		$firstError		= FALSE;
		$firstWarning	= FALSE;
		
		// cookie infos
		$showQueries	= isset($_COOKIE['LogShowQueries']) ? (bool)$_COOKIE['LogShowQueries'] : FALSE;
		$showEvents		= isset($_COOKIE['LogShowEvents'])  ? (bool)$_COOKIE['LogShowEvents']  : FALSE;
		
		// create a date in timezone of connected user
		$timeStart = new \DateTime('@' . (int)$this->timeStart, new \DateTimeZone(BASE_TIMEZONE));
		if ($app->currentUser and $app->currentUser->areKeysPopulated()) {
			$timeStart->setTimezone($app->currentUser->getDateTimeZone());
		}
		
		// get memory limit
		$limit = ini_get('memory_limit');
		
		// get number multiplier
		switch (substr($limit,-1)) {
			case 'G': case 'g': $multiplier = 1073741824;	break;
			case 'M': case 'm': $multiplier = 1048576;		break;
			case 'K': case 'k': $multiplier = 1024;			break;
			default:			$multiplier = 1;			break;
		}
			
		// convert string memory limit to integer
		$limit = (int)$limit * $multiplier;
		
		// get current usage and percentual ratio
		$ratio = memory_get_usage() / $limit * 100;
		
		// alert about risk of “out of memory”
		if (($ratio) > 60) {
			$this->addWarning('Memory usage is ' . round($ratio,0) . '% of limit, will reduce logs');			
		}
		
		foreach ($this->events as $e) {

			// update ratio with current memory usage
			$ratio = memory_get_usage() / $limit * 100;

			// prevent out memory errors by adding just warnings and errors
			if ($ratio > 60 and !in_array($e->type, ['warning','error'])) {
				continue;
			}
			
			$eventDomId = '';
			
			switch ($e->type) {
				
				// external API-call counters
				case 'api':
					$apiChrono += $e->chrono;
					break;
			
				// SQL queries counters
				case 'query':
					$queryCount++;
					$queryChrono += $e->chrono;
					break;
			
				// warning counter
				case 'warning':
					$warningCount++;
					if (!$firstWarning) {
						$eventDomId = 'id="logFirstWarning" ';
						$firstWarning = TRUE;
					}
					break;
				
				// error counter
				case 'error':
					$errorCount++;
					if (!$firstError) {
						$eventDomId = 'id="logFirstError" ';
						$firstError = TRUE;
					}
					break;
	
			}

			// if it's query, verifies cookie val
			$class = $e->type . (('query'==$e->type and !$showQueries) ? ' hidden' : '');

			$log .=
				'<div ' . $eventDomId . 'class="' . $class . '">' .
				'<span class="time' . ($e->chrono>1 ? ' slow' : '') . '">' . $this->formatChrono($e->chrono) . '</span> ' .
				htmlspecialchars($e->description) .
				($e->subtext ? ' <span>| ' . htmlspecialchars($e->subtext) . '</span>' : '') . '</div>';

			$sum += $e->chrono;
			
		}
		
		// log header
		$ret = '<div id="log">';
		$ret.= '<div class="head">';
		
		// log date
		$ret.= '<div class="item"><span class="icon fa fa-clock"></span><span class="emph">' . $timeStart->format('Y-m-d H:i:s') . '</span></div>';

		// external api
		$ret.= $apiChrono ? '<div class="item"><span class="icon fa fa-exchange"></span><span class="emph">API ' . $this->formatChrono($apiChrono) . '</span></div>' : '';
		
		// database 
		$ret.= '<div class="item database multi' . ($showQueries ? ' active' : '') . '"><div class="icon fa fa-database"></div><div class="desc"><span class="emph">' . $queryCount .'</span> queries <div class="sub">(' . $this->formatChrono($queryChrono) .')</div></div></div>';
		
		// total time
		$ret.= '<div class="item"><span class="icon fa fa-tachometer-alt"></span><span class="emph">' . $this->formatChrono($sum) .'</span> total</div>';
		
		// memory peak
		$ret.= '<div class="item"><span class="icon fa fa-heartbeat"></span><span class="emph">' . floor(memory_get_peak_usage()/1024/1024) . ' MB</span> memory</div>';

		// warnings
		if ($warningCount) {
			$ret.= '<a href="javascript:;" onclick="document.location.hash=\'logFirstWarning\';" class="item warning"><span class="icon fa fa-exclamation-triangle"></span><span class="emph">' . $warningCount . '</span> ' . ($warningCount>1 ? 'warnings' : 'warning') . '</a>';
		}
		
		// errors
		if ($errorCount) {
			$ret.= '<a href="javascript:;" onclick="document.location.hash=\'logFirstError\';" class="item error"><span class="icon fa fa-times-circle"></span><span class="emph">' . $errorCount . '</span> ' . ($errorCount>1 ? 'errors' : 'error') . '</a>';
		}
		
		// show/hide log button
		if ($showEvents) {
			$ret.= '<div id="logShowEvents" class="item active">Hide <span class="fa fa-caret-up"></span></div>';
		} else {
			$ret.= '<div id="logShowEvents" class="item">Show <span class="fa fa-caret-down"></span></div>';
		}
		
		$ret.= '</div>';
		
		// log content
		$ret.= '<div class="events' . ($showEvents ? '' : ' hidden') . '">' . $log . '</div></div>';
		
		return $ret;
		
	}
923896
protected function get_legacy_logdata() {
        $attempt = $this->get_record_snapshot('quiz_attempts', $this->objectid);

        return array($this->courseid, 'quiz', 'attempt', 'review.php?attempt=' . $this->objectid,
            $attempt->quiz, $this->contextinstanceid);
    }
672366
protected function getLog()
    {
        if ($this->log == null) {
            $this->log = Tlog::getNewInstance();

            $logFilePath = $this->getLogFilePath();

            $this->log->setPrefix("#LEVEL: #DATE #HOUR: ");
            $this->log->setDestinations("\\Thelia\\Log\\Destination\\TlogDestinationFile");
            $this->log->setConfig("\\Thelia\\Log\\Destination\\TlogDestinationFile", 0, $logFilePath);
            $this->log->setLevel(Tlog::INFO);
        }

        return $this->log;
    }
224524
public function getLastMessage() {
		$count = count($this->_data);
		if (!$count) {
			return null;
		}
		return $this->_data[$count - 1];
	}
541266
protected function get_legacy_logdata() {
        $url = new \moodle_url('report.php', array('id' => $this->contextinstanceid));
        return array($this->courseid, 'choice', 'report', $url->out(), $this->objectid, $this->contextinstanceid);
    }