Refactor dynamic App::getLogger() to static DI::logger()
This commit is contained in:
parent
fceb4f3823
commit
e2b2778e0a
|
@ -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)]);
|
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) {
|
if (false === $return) {
|
||||||
/*
|
/*
|
||||||
|
|
10
src/App.php
10
src/App.php
|
@ -155,16 +155,6 @@ class App
|
||||||
return $this->config->getCache()->get('system', 'basepath');
|
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
|
* The profiler of this app
|
||||||
*
|
*
|
||||||
|
|
|
@ -351,7 +351,7 @@ class Authentication
|
||||||
* The week ensures that sessions will expire after some inactivity.
|
* The week ensures that sessions will expire after some inactivity.
|
||||||
*/;
|
*/;
|
||||||
if ($this->session->get('remember')) {
|
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->cookie->set($user_record['uid'], $user_record['password'], $user_record['prvkey']);
|
||||||
$this->session->remove('remember');
|
$this->session->remove('remember');
|
||||||
}
|
}
|
||||||
|
|
|
@ -443,7 +443,7 @@ class Worker
|
||||||
|
|
||||||
Logger::info('Process done.', ['priority' => $queue["priority"], 'id' => $queue["id"], 'duration' => round($duration, 3)]);
|
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);
|
$cooldown = Config::get("system", "worker_cooldown", 0);
|
||||||
|
|
||||||
|
@ -1086,7 +1086,7 @@ class Worker
|
||||||
$args = ['no_cron' => !$do_cron];
|
$args = ['no_cron' => !$do_cron];
|
||||||
|
|
||||||
$a = get_app();
|
$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);
|
$process->run($command, $args);
|
||||||
|
|
||||||
// after spawning we have to remove the flag.
|
// after spawning we have to remove the flag.
|
||||||
|
|
|
@ -18,9 +18,8 @@ class Nodeinfo
|
||||||
*/
|
*/
|
||||||
public static function update()
|
public static function update()
|
||||||
{
|
{
|
||||||
$app = DI::app();
|
|
||||||
$config = DI::config();
|
$config = DI::config();
|
||||||
$logger = $app->getLogger();
|
$logger = DI::logger();
|
||||||
|
|
||||||
// If the addon 'statistics_json' is enabled then disable it and activate nodeinfo.
|
// If the addon 'statistics_json' is enabled then disable it and activate nodeinfo.
|
||||||
if (Addon::isEnabled('statistics_json')) {
|
if (Addon::isEnabled('statistics_json')) {
|
||||||
|
|
|
@ -118,7 +118,7 @@ class Summary extends BaseAdminModule
|
||||||
$currBasepath = DI::config()->get('system', 'basepath');
|
$currBasepath = DI::config()->get('system', 'basepath');
|
||||||
if ($confBasepath !== $currBasepath || !is_dir($currBasepath)) {
|
if ($confBasepath !== $currBasepath || !is_dir($currBasepath)) {
|
||||||
if (is_dir($confBasepath) && Config::set('system', 'basepath', $confBasepath)) {
|
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,
|
'from' => $currBasepath,
|
||||||
'to' => $confBasepath,
|
'to' => $confBasepath,
|
||||||
]);
|
]);
|
||||||
|
@ -126,7 +126,7 @@ class Summary extends BaseAdminModule
|
||||||
$currBasepath,
|
$currBasepath,
|
||||||
$confBasepath);
|
$confBasepath);
|
||||||
} elseif (!is_dir($currBasepath)) {
|
} elseif (!is_dir($currBasepath)) {
|
||||||
$a->getLogger()->alert('Friendica\'s system.basepath is wrong.', [
|
DI::logger()->alert('Friendica\'s system.basepath is wrong.', [
|
||||||
'from' => $currBasepath,
|
'from' => $currBasepath,
|
||||||
'to' => $confBasepath,
|
'to' => $confBasepath,
|
||||||
]);
|
]);
|
||||||
|
@ -134,7 +134,7 @@ class Summary extends BaseAdminModule
|
||||||
$currBasepath,
|
$currBasepath,
|
||||||
$confBasepath);
|
$confBasepath);
|
||||||
} else {
|
} else {
|
||||||
$a->getLogger()->alert('Friendica\'s system.basepath is wrong.', [
|
DI::logger()->alert('Friendica\'s system.basepath is wrong.', [
|
||||||
'from' => $currBasepath,
|
'from' => $currBasepath,
|
||||||
'to' => $confBasepath,
|
'to' => $confBasepath,
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -20,7 +20,7 @@ class RemoveTag extends BaseModule
|
||||||
}
|
}
|
||||||
|
|
||||||
$app = DI::app();
|
$app = DI::app();
|
||||||
$logger = $app->getLogger();
|
$logger = DI::logger();
|
||||||
|
|
||||||
$item_id = (($app->argc > 1) ? intval($app->argv[1]) : 0);
|
$item_id = (($app->argc > 1) ? intval($app->argv[1]) : 0);
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ class SaveTag extends BaseModule
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
$a = DI::app();
|
$a = DI::app();
|
||||||
$logger = $a->getLogger();
|
$logger = DI::logger();
|
||||||
|
|
||||||
$term = XML::unescape(trim($_GET['term'] ?? ''));
|
$term = XML::unescape(trim($_GET['term'] ?? ''));
|
||||||
// @TODO: Replace with parameter from router
|
// @TODO: Replace with parameter from router
|
||||||
|
|
|
@ -19,7 +19,7 @@ class Statistics extends BaseModule
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
$config = DI::config();
|
$config = DI::config();
|
||||||
$logger = DI::app()->getLogger();
|
$logger = DI::logger();
|
||||||
|
|
||||||
$registration_open =
|
$registration_open =
|
||||||
intval($config->get('config', 'register_policy')) !== Register::CLOSED
|
intval($config->get('config', 'register_policy')) !== Register::CLOSED
|
||||||
|
|
Loading…
Reference in a new issue