use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Core\Theme;
*/
private $basePath;
+ private $timestamp = 0;
+ private $command = '';
+ private $method = '';
+
/**
* @param string $basepath The Page basepath
*/
public function __construct(string $basepath)
{
+ $this->timestamp = microtime(true);
$this->basePath = $basepath;
}
+ public function setLogging(string $command, string $method)
+ {
+ $this->command = $command;
+ $this->method = $method;
+ }
+
+ public function logRuntime(IManageConfigValues $config, string $origin = '')
+ {
+ if (in_array($this->command, $config->get('system', 'runtime_ignore'))) {
+ return;
+ }
+
+ $runtime = number_format(microtime(true) - $this->timestamp, 3);
+ if ($runtime > $config->get('system', 'runtime_loglimit')) {
+ Logger::debug('Runtime', ['method' => $this->method, 'command' => $this->command, 'runtime' => $runtime, 'origin' => $origin]);
+ }
+ }
+
/**
* Whether a offset exists
*
{
$moduleName = $args->getModuleName();
+ $this->command = $moduleName;
+ $this->method = $args->getMethod();
+
/* Create the page content.
* Calls all hooks which are including content operations
*