From: Michael Date: Wed, 18 May 2022 03:10:38 +0000 (+0000) Subject: Configuration for logging added X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4622814e5f6cd22d421ded545be74c745d593483;p=friendica.git Configuration for logging added --- diff --git a/src/App.php b/src/App.php index 07296cecf0..5fc4c87ffe 100644 --- a/src/App.php +++ b/src/App.php @@ -719,7 +719,7 @@ class App } catch (HTTPException $e) { (new ModuleHTTPException())->rawContent($e); } - $page->logRuntime(); + $page->logRuntime($this->config); } /** diff --git a/src/App/Page.php b/src/App/Page.php index 305b2962b9..c78d0f9e0c 100644 --- a/src/App/Page.php +++ b/src/App/Page.php @@ -98,10 +98,16 @@ class Page implements ArrayAccess $this->method = $method; } - public function logRuntime() + public function logRuntime(IManageConfigValues $config) { + if (in_array($this->command, $config->get('system', 'runtime_ignore'))) { + return; + } + $runtime = number_format(microtime(true) - $this->timestamp, 3); - Logger::debug('Runtime', ['method' => $this->method, 'command' => $this->command, 'runtime' => $runtime]); + if ($runtime > $config->get('system', 'runtime_loglimit')) { + Logger::debug('Runtime', ['method' => $this->method, 'command' => $this->command, 'runtime' => $runtime]); + } } /** diff --git a/src/Core/System.php b/src/Core/System.php index 10fc5c7d4e..6f1bb61884 100644 --- a/src/Core/System.php +++ b/src/Core/System.php @@ -369,7 +369,7 @@ class System */ public static function exit() { - DI::page()->logRuntime(); + DI::page()->logRuntime(DI::config()); exit(); } diff --git a/static/defaults.config.php b/static/defaults.config.php index 959315f888..db440d2a96 100644 --- a/static/defaults.config.php +++ b/static/defaults.config.php @@ -507,6 +507,14 @@ return [ // If enabled, multiple linefeeds in items are stripped to a single one. 'remove_multiplicated_lines' => false, + // runtime_ignore (Array) + // List of ignored commands for the runtime logging. + 'runtime_ignore' => [], + + // runtime_loglimit (Integer) + // The runtime is logged, When the program execution time is higher than this value. + 'runtime_loglimit' => 0, + // sendmail_params (Boolean) // Normal sendmail command parameters will be added when the PHP mail() function is called for sending e-mails. // This ensures the Sender Email address setting is applied to the message envelope rather than the host's default address.