]> git.mxchange.org Git - friendica.git/commitdiff
Configuration for logging added
authorMichael <heluecht@pirati.ca>
Wed, 18 May 2022 03:10:38 +0000 (03:10 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 18 May 2022 03:10:38 +0000 (03:10 +0000)
src/App.php
src/App/Page.php
src/Core/System.php
static/defaults.config.php

index 07296cecf08fb45e6f0b4b7f26e388ada2a9cd95..5fc4c87ffed99915076374ae9dbb20578a7eb689 100644 (file)
@@ -719,7 +719,7 @@ class App
                } catch (HTTPException $e) {
                        (new ModuleHTTPException())->rawContent($e);
                }
-               $page->logRuntime();
+               $page->logRuntime($this->config);
        }
 
        /**
index 305b2962b9c70e856ba31c67ab28394e82d1c457..c78d0f9e0c53b5f95a4a34774b62bfdfcf9f52a0 100644 (file)
@@ -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]);
+               }
        }
 
        /**
index 10fc5c7d4e335e6cdc725affb1672f93c572ea8d..6f1bb618842a07e52c9c2ecf178a3d31338a5628 100644 (file)
@@ -369,7 +369,7 @@ class System
         */
        public static function exit()
        {
-               DI::page()->logRuntime();
+               DI::page()->logRuntime(DI::config());
                exit();
        }
 
index 959315f8881b84891c46d96099f676bab96028cf..db440d2a96dbf4470ef31040684310136f4bb2a1 100644 (file)
@@ -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.