diff --git a/include/api.php b/include/api.php index 363a0b9700..12f5dcb8ab 100644 --- a/include/api.php +++ b/include/api.php @@ -328,7 +328,7 @@ function api_call(App $a) Logger::info(API_LOG_PREFIX . 'username {username}', ['module' => 'api', 'action' => 'call', 'username' => $a->user['username'], 'duration' => round($duration, 2)]); - $a->getProfiler()->saveLog($a->getLogger(), API_LOG_PREFIX . 'performance'); + $a->getProfiler()->saveLog(DI::logger(), API_LOG_PREFIX . 'performance'); if (false === $return) { /* diff --git a/src/App.php b/src/App.php index 6f1045ada5..ac0f45f9b5 100644 --- a/src/App.php +++ b/src/App.php @@ -155,16 +155,6 @@ class App return $this->config->getCache()->get('system', 'basepath'); } - /** - * The Logger of this app - * - * @return LoggerInterface - */ - public function getLogger() - { - return $this->logger; - } - /** * The profiler of this app * diff --git a/src/App/Authentication.php b/src/App/Authentication.php index b88690415c..b1424e0fd6 100644 --- a/src/App/Authentication.php +++ b/src/App/Authentication.php @@ -351,7 +351,7 @@ class Authentication * The week ensures that sessions will expire after some inactivity. */; if ($this->session->get('remember')) { - $a->getLogger()->info('Injecting cookie for remembered user ' . $user_record['nickname']); + $this->logger->info('Injecting cookie for remembered user ' . $user_record['nickname']); $this->cookie->set($user_record['uid'], $user_record['password'], $user_record['prvkey']); $this->session->remove('remember'); } diff --git a/src/Core/Worker.php b/src/Core/Worker.php index a87fef0771..d4a90dd196 100644 --- a/src/Core/Worker.php +++ b/src/Core/Worker.php @@ -443,7 +443,7 @@ class Worker Logger::info('Process done.', ['priority' => $queue["priority"], 'id' => $queue["id"], 'duration' => round($duration, 3)]); - $a->getProfiler()->saveLog($a->getLogger(), "ID " . $queue["id"] . ": " . $funcname); + $a->getProfiler()->saveLog(DI::logger(), "ID " . $queue["id"] . ": " . $funcname); $cooldown = Config::get("system", "worker_cooldown", 0); @@ -1086,7 +1086,7 @@ class Worker $args = ['no_cron' => !$do_cron]; $a = get_app(); - $process = new Core\Process($a->getLogger(), $a->getMode(), DI::config(), $a->getBasePath()); + $process = new Core\Process(DI::logger(), $a->getMode(), DI::config(), $a->getBasePath()); $process->run($command, $args); // after spawning we have to remove the flag. diff --git a/src/Model/Nodeinfo.php b/src/Model/Nodeinfo.php index 58a9e45447..6d9c77154a 100644 --- a/src/Model/Nodeinfo.php +++ b/src/Model/Nodeinfo.php @@ -18,9 +18,8 @@ class Nodeinfo */ public static function update() { - $app = DI::app(); $config = DI::config(); - $logger = $app->getLogger(); + $logger = DI::logger(); // If the addon 'statistics_json' is enabled then disable it and activate nodeinfo. if (Addon::isEnabled('statistics_json')) { diff --git a/src/Module/Admin/Summary.php b/src/Module/Admin/Summary.php index 60b35289c9..d634b89fbf 100644 --- a/src/Module/Admin/Summary.php +++ b/src/Module/Admin/Summary.php @@ -118,7 +118,7 @@ class Summary extends BaseAdminModule $currBasepath = DI::config()->get('system', 'basepath'); if ($confBasepath !== $currBasepath || !is_dir($currBasepath)) { if (is_dir($confBasepath) && Config::set('system', 'basepath', $confBasepath)) { - $a->getLogger()->info('Friendica\'s system.basepath was updated successfully.', [ + DI::logger()->info('Friendica\'s system.basepath was updated successfully.', [ 'from' => $currBasepath, 'to' => $confBasepath, ]); @@ -126,7 +126,7 @@ class Summary extends BaseAdminModule $currBasepath, $confBasepath); } elseif (!is_dir($currBasepath)) { - $a->getLogger()->alert('Friendica\'s system.basepath is wrong.', [ + DI::logger()->alert('Friendica\'s system.basepath is wrong.', [ 'from' => $currBasepath, 'to' => $confBasepath, ]); @@ -134,7 +134,7 @@ class Summary extends BaseAdminModule $currBasepath, $confBasepath); } else { - $a->getLogger()->alert('Friendica\'s system.basepath is wrong.', [ + DI::logger()->alert('Friendica\'s system.basepath is wrong.', [ 'from' => $currBasepath, 'to' => $confBasepath, ]); diff --git a/src/Module/Filer/RemoveTag.php b/src/Module/Filer/RemoveTag.php index 65fd6cdf36..5ecaf4c2f9 100644 --- a/src/Module/Filer/RemoveTag.php +++ b/src/Module/Filer/RemoveTag.php @@ -20,7 +20,7 @@ class RemoveTag extends BaseModule } $app = DI::app(); - $logger = $app->getLogger(); + $logger = DI::logger(); $item_id = (($app->argc > 1) ? intval($app->argv[1]) : 0); diff --git a/src/Module/Filer/SaveTag.php b/src/Module/Filer/SaveTag.php index 1e19cdff19..9c0709db90 100644 --- a/src/Module/Filer/SaveTag.php +++ b/src/Module/Filer/SaveTag.php @@ -26,7 +26,7 @@ class SaveTag extends BaseModule public static function rawContent(array $parameters = []) { $a = DI::app(); - $logger = $a->getLogger(); + $logger = DI::logger(); $term = XML::unescape(trim($_GET['term'] ?? '')); // @TODO: Replace with parameter from router diff --git a/src/Module/Statistics.php b/src/Module/Statistics.php index 11cbdf53af..ce15426b8a 100644 --- a/src/Module/Statistics.php +++ b/src/Module/Statistics.php @@ -19,7 +19,7 @@ class Statistics extends BaseModule public static function rawContent(array $parameters = []) { $config = DI::config(); - $logger = DI::app()->getLogger(); + $logger = DI::logger(); $registration_open = intval($config->get('config', 'register_policy')) !== Register::CLOSED