From df1c3658723d3d2f1d2e42053c067468007f5daf Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Thu, 27 Mar 2025 10:28:13 +0900 Subject: [PATCH] Enable logging in FrontEndFileHandler --- .../FrontEndFileHandler.class.php | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/classes/frontendfile/FrontEndFileHandler.class.php b/classes/frontendfile/FrontEndFileHandler.class.php index a09a69142..d428d4099 100644 --- a/classes/frontendfile/FrontEndFileHandler.class.php +++ b/classes/frontendfile/FrontEndFileHandler.class.php @@ -53,6 +53,12 @@ class FrontEndFileHandler extends Handler */ public $jsBodyMapIndex = array(); + /** + * Logging + */ + protected $_log_enabled = false; + protected $_log_entries = []; + /** * Check SSL * @@ -92,6 +98,10 @@ class FrontEndFileHandler extends Handler { $args = array($args); } + if ($this->_log_enabled) + { + $this->_log_entries[] = $args; + } // Replace obsolete paths with current paths. $args[0] = preg_replace(array_keys(HTMLDisplayHandler::$replacements), array_values(HTMLDisplayHandler::$replacements), $args[0]); @@ -252,6 +262,26 @@ class FrontEndFileHandler extends Handler return $file; } + /** + * Start logging. + */ + public function startLog() + { + $this->_log_enabled = true; + $this->_log_entries = []; + } + + /** + * End logging and return the log entries. + * + * @return array + */ + public function endLog(): array + { + $this->_log_enabled = false; + return $this->_log_entries; + } + /** * Process CSS and JS file *