23 $this->level = Logger::toMonologLevel(
$level);
33 public function __invoke(LogRecord $record): LogRecord {
35 if ($record->level->isLowerThan($this->level)) {
39 if (isset($record->context[
'throwable'])) {
44 $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
45 foreach ($backtrace as
$index => $trace) {
46 if (isset($trace[
'file'])) {
48 if (str_contains($trace[
'file'],
'\Monolog\\')) {
53 if (str_contains($trace[
'file'],
'\Elgg\Logger.php')) {
58 if (str_contains($trace[
'file'],
'\lib\elgglib.php')) {
67 $i = count($backtrace);
68 $backtrace_level = $this->backtrace_level;
71 foreach ($backtrace as $trace) {
72 if (empty($trace[
'file'])) {
74 $stack[] =
"[#$i] unknown";
76 $stack[] =
"[#$i] {$trace['file']}:{$trace['line']}";
81 if ($backtrace_level > 0) {
82 if ($backtrace_level <= 1) {
90 $record[
'extra'][
'backtrace'] = $stack;
Inject backtrace stack into the record.
__construct($level=Level::Warning, protected int $backtrace_level=-1)
Constructor.
__invoke(LogRecord $record)
Process record.
if(parse_url(elgg_get_site_url(), PHP_URL_PATH) !=='/') if(file_exists(elgg_get_root_path() . 'robots.txt'))
Set robots.txt.