ErrorLogs.php in DRD Agent 8.3
File
src/Agent/Action/ErrorLogs.php
View source
<?php
namespace Drupal\drd_agent\Agent\Action;
class ErrorLogs extends Base {
public function execute() {
$args = $this
->getArguments();
$max_length = $args['maxLength'] ?? 5000;
$log_file = ini_get('error_log');
if (!file_exists($log_file)) {
return [];
}
$offset = max(-1, filesize($log_file) - $max_length);
$log = file_get_contents($log_file, FILE_BINARY, NULL, $offset);
$result['php error log'] = $log;
return $result;
}
}