Hard deprecate all Logger methods

This commit is contained in:
Art4 2025-01-31 07:55:53 +00:00
parent f1dfa63764
commit c363b45e0d

View file

@ -8,7 +8,6 @@
namespace Friendica\Core; namespace Friendica\Core;
use Friendica\DI; use Friendica\DI;
use Friendica\Core\Logger\Type\WorkerLogger;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
/** /**
@ -18,10 +17,7 @@ use Psr\Log\LoggerInterface;
*/ */
class Logger class Logger
{ {
/** private static function getInstance(): LoggerInterface
* @return LoggerInterface|WorkerLogger
*/
private static function getInstance()
{ {
return DI::logger(); return DI::logger();
} }
@ -38,6 +34,8 @@ class Logger
*/ */
public static function emergency(string $message, array $context = []) public static function emergency(string $message, array $context = [])
{ {
trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use constructor injection or `DI::logger()` instead.', E_USER_DEPRECATED);
self::getInstance()->emergency($message, $context); self::getInstance()->emergency($message, $context);
} }
@ -55,6 +53,8 @@ class Logger
*/ */
public static function alert(string $message, array $context = []) public static function alert(string $message, array $context = [])
{ {
trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use constructor injection or `DI::logger()` instead.', E_USER_DEPRECATED);
self::getInstance()->alert($message, $context); self::getInstance()->alert($message, $context);
} }
@ -71,6 +71,8 @@ class Logger
*/ */
public static function critical(string $message, array $context = []) public static function critical(string $message, array $context = [])
{ {
trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use constructor injection or `DI::logger()` instead.', E_USER_DEPRECATED);
self::getInstance()->critical($message, $context); self::getInstance()->critical($message, $context);
} }
@ -86,6 +88,8 @@ class Logger
*/ */
public static function error(string $message, array $context = []) public static function error(string $message, array $context = [])
{ {
trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use constructor injection or `DI::logger()` instead.', E_USER_DEPRECATED);
self::getInstance()->error($message, $context); self::getInstance()->error($message, $context);
} }
@ -103,6 +107,8 @@ class Logger
*/ */
public static function warning(string $message, array $context = []) public static function warning(string $message, array $context = [])
{ {
trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use constructor injection or `DI::logger()` instead.', E_USER_DEPRECATED);
self::getInstance()->warning($message, $context); self::getInstance()->warning($message, $context);
} }
@ -117,6 +123,8 @@ class Logger
*/ */
public static function notice(string $message, array $context = []) public static function notice(string $message, array $context = [])
{ {
trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use constructor injection or `DI::logger()` instead.', E_USER_DEPRECATED);
self::getInstance()->notice($message, $context); self::getInstance()->notice($message, $context);
} }
@ -134,6 +142,8 @@ class Logger
*/ */
public static function info(string $message, array $context = []) public static function info(string $message, array $context = [])
{ {
trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use constructor injection or `DI::logger()` instead.', E_USER_DEPRECATED);
self::getInstance()->info($message, $context); self::getInstance()->info($message, $context);
} }
@ -148,6 +158,8 @@ class Logger
*/ */
public static function debug(string $message, array $context = []) public static function debug(string $message, array $context = [])
{ {
trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use constructor injection or `DI::logger()` instead.', E_USER_DEPRECATED);
self::getInstance()->debug($message, $context); self::getInstance()->debug($message, $context);
} }
} }