]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Logger/Type/StreamLogger.php
Move Monolog to Addons
[friendica.git] / src / Core / Logger / Type / StreamLogger.php
index be0283d0ec250f13a5686d73981e303414c4890e..a7d4d1d0e12ae9810966c1b03b652fdacad3829f 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -23,9 +23,10 @@ namespace Friendica\Core\Logger\Type;
 
 use Friendica\Core\Logger\Exception\LoggerArgumentException;
 use Friendica\Core\Logger\Exception\LoggerException;
+use Friendica\Core\Logger\Exception\LogLevelException;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\FileSystem;
-use Friendica\Util\Introspection;
+use Friendica\Core\Logger\Util\Introspection;
 use Psr\Log\LogLevel;
 
 /**
@@ -83,6 +84,7 @@ class StreamLogger extends AbstractLogger
         * @param string          $level  The minimum loglevel at which this logger will be triggered
         *
         * @throws LoggerArgumentException
+        * @throws LogLevelException
         */
        public function __construct($channel, $stream, Introspection $introspection, FileSystem $fileSystem, string $level = LogLevel::DEBUG)
        {
@@ -102,7 +104,7 @@ class StreamLogger extends AbstractLogger
                if (array_key_exists($level, $this->levelToInt)) {
                        $this->logLevel = $this->levelToInt[$level];
                } else {
-                       throw new LoggerArgumentException(sprintf('The level "%s" is not valid.', $level));
+                       throw new LogLevelException(sprintf('The level "%s" is not valid.', $level));
                }
 
                $this->checkStream();
@@ -127,12 +129,12 @@ class StreamLogger extends AbstractLogger
         * @return void
         *
         * @throws LoggerException
-        * @throws LoggerArgumentException
+        * @throws LogLevelException
         */
        protected function addEntry($level, string $message, array $context = [])
        {
                if (!array_key_exists($level, $this->levelToInt)) {
-                       throw new LoggerArgumentException(sprintf('The level "%s" is not valid.', $level));
+                       throw new LogLevelException(sprintf('The level "%s" is not valid.', $level));
                }
 
                $logLevel = $this->levelToInt[$level];