]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/Profiler.php
Move mod/rsd_xml to src/Module/ReallySimpleDiscovery
[friendica.git] / src / Util / Profiler.php
index 115e75f7ba6ce44f97962fed9717653f3b19e62a..fe72efce40beec2e623598e3c6efd35c050d3f54 100644 (file)
@@ -32,6 +32,28 @@ class Profiler implements ContainerInterface
         */
        private $rendertime;
 
+       /**
+        * True, if the Profiler should measure the whole rendertime including functions
+        *
+        * @return bool
+        */
+       public function isRendertime()
+       {
+               return $this->rendertime;
+       }
+
+       /**
+        * Updates the enabling of the current profiler
+        *
+        * @param bool $enabled
+        * @param bool $renderTime
+        */
+       public function update($enabled = false, $renderTime = false)
+       {
+               $this->enabled = $enabled;
+               $this->rendertime = $renderTime;
+       }
+
        /**
         * @param bool $enabled           True, if the Profiler is enabled
         * @param bool $renderTime        True, if the Profiler should measure the whole rendertime including functions
@@ -207,8 +229,10 @@ class Profiler implements ContainerInterface
                        ]
                );
 
-               $output = $this->getRendertimeString();
-               $logger->info($message . ": " . $output, ['action' => 'profiling']);
+               if ($this->isRendertime()) {
+                       $output = $this->getRendertimeString();
+                       $logger->info($message . ": " . $output, ['action' => 'profiling']);
+               }
        }
 
        /**