message = $message; # not escaped $this->tags = $tags; $this->timestamp = \time(); if ($backtrace === null) { $backtrace = \debug_backtrace(); $key = \array_search(__FUNCTION__, \array_column($backtrace, 'function'),); # NOTE: manual search, can change with time $backtrace = $backtrace[$key]; } $this->backtrace = $backtrace; } /** * Display this event for logging * * This can be changed from configuration. * The EOL (end of line sequence) is automatically added at the end. */ public function display() : \string { $configuration = \core\config\GlobalConfiguration::read('class', 'core', 'log'); $format = '[{tags}] - {date}: {message} in {file} at line {line}'; # NOTE: hard-coded fallback $date_format = 'Y-m-d H:i:s'; # NOTE: hard-coded fallback if ($configuration->exist('format')) { $format = $configuration->get('format'); } if ($configuration->exist('date-format')) { $date_format = $configuration->get('date-format'); } return \core\substitute( $format, array( 'date' => \date($date_format), 'file' => $this->backtrace['file'], 'line' => $this->backtrace['line'], 'message' => $this->message, 'tags' => $this->tags, ), ) . \PHP_EOL; } } ?>