]> git.mxchange.org Git - friendica.git/commitdiff
Hard deprecate all Logger methods
authorArt4 <art4@wlabs.de>
Fri, 31 Jan 2025 07:55:53 +0000 (07:55 +0000)
committerArt4 <art4@wlabs.de>
Fri, 31 Jan 2025 07:55:53 +0000 (07:55 +0000)
src/Core/Logger.php

index a87be78633df6cad0b79c25c87a8a37f5c802df3..a050f7e2451dea00e58657528aa63d2df07eb703 100644 (file)
@@ -8,7 +8,6 @@
 namespace Friendica\Core;
 
 use Friendica\DI;
-use Friendica\Core\Logger\Type\WorkerLogger;
 use Psr\Log\LoggerInterface;
 
 /**
@@ -18,10 +17,7 @@ use Psr\Log\LoggerInterface;
  */
 class Logger
 {
-       /**
-        * @return LoggerInterface|WorkerLogger
-        */
-       private static function getInstance()
+       private static function getInstance(): LoggerInterface
        {
                return DI::logger();
        }
@@ -38,6 +34,8 @@ class Logger
         */
        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);
        }
 
@@ -55,6 +53,8 @@ class Logger
         */
        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);
        }
 
@@ -71,6 +71,8 @@ class Logger
         */
        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);
        }
 
@@ -86,6 +88,8 @@ class Logger
         */
        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);
        }
 
@@ -103,6 +107,8 @@ class Logger
         */
        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);
        }
 
@@ -117,6 +123,8 @@ class Logger
         */
        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);
        }
 
@@ -134,6 +142,8 @@ class Logger
         */
        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);
        }
 
@@ -148,6 +158,8 @@ class Logger
         */
        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);
        }
 }