Skip to content

Commit

Permalink
chore: update psr/log to v2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Sep 24, 2023
1 parent 760dbf4 commit ec661ef
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 157 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"ext-json": "*",
"ext-mbstring": "*",
"laminas/laminas-escaper": "^2.9",
"psr/log": "^1.1"
"psr/log": "^2.0"
},
"require-dev": {
"codeigniter/coding-standard": "^1.5",
Expand Down
3 changes: 1 addition & 2 deletions system/ComposerScripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ final class ComposerScripts
],
'psr-log' => [
'license' => __DIR__ . '/../vendor/psr/log/LICENSE',
'from' => __DIR__ . '/../vendor/psr/log/Psr/Log/',
'from' => __DIR__ . '/../vendor/psr/log/src/',
'to' => __DIR__ . '/ThirdParty/PSR/Log/',
],
];
Expand Down Expand Up @@ -84,7 +84,6 @@ public static function postUpdate()
}

self::copyKintInitFiles();
self::recursiveDelete(self::$dependencies['psr-log']['to'] . 'Test/');
}

/**
Expand Down
115 changes: 1 addition & 114 deletions system/ThirdParty/PSR/Log/AbstractLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,118 +11,5 @@
*/
abstract class AbstractLogger implements LoggerInterface
{
/**
* System is unusable.
*
* @param string $message
* @param mixed[] $context
*
* @return void
*/
public function emergency($message, array $context = array())
{
$this->log(LogLevel::EMERGENCY, $message, $context);
}

/**
* Action must be taken immediately.
*
* Example: Entire website down, database unavailable, etc. This should
* trigger the SMS alerts and wake you up.
*
* @param string $message
* @param mixed[] $context
*
* @return void
*/
public function alert($message, array $context = array())
{
$this->log(LogLevel::ALERT, $message, $context);
}

/**
* Critical conditions.
*
* Example: Application component unavailable, unexpected exception.
*
* @param string $message
* @param mixed[] $context
*
* @return void
*/
public function critical($message, array $context = array())
{
$this->log(LogLevel::CRITICAL, $message, $context);
}

/**
* Runtime errors that do not require immediate action but should typically
* be logged and monitored.
*
* @param string $message
* @param mixed[] $context
*
* @return void
*/
public function error($message, array $context = array())
{
$this->log(LogLevel::ERROR, $message, $context);
}

/**
* Exceptional occurrences that are not errors.
*
* Example: Use of deprecated APIs, poor use of an API, undesirable things
* that are not necessarily wrong.
*
* @param string $message
* @param mixed[] $context
*
* @return void
*/
public function warning($message, array $context = array())
{
$this->log(LogLevel::WARNING, $message, $context);
}

/**
* Normal but significant events.
*
* @param string $message
* @param mixed[] $context
*
* @return void
*/
public function notice($message, array $context = array())
{
$this->log(LogLevel::NOTICE, $message, $context);
}

/**
* Interesting events.
*
* Example: User logs in, SQL logs.
*
* @param string $message
* @param mixed[] $context
*
* @return void
*/
public function info($message, array $context = array())
{
$this->log(LogLevel::INFO, $message, $context);
}

/**
* Detailed debug information.
*
* @param string $message
* @param mixed[] $context
*
* @return void
*/
public function debug($message, array $context = array())
{
$this->log(LogLevel::DEBUG, $message, $context);
}
use LoggerTrait;
}
2 changes: 1 addition & 1 deletion system/ThirdParty/PSR/Log/LoggerAwareTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait LoggerAwareTrait
*
* @var LoggerInterface|null
*/
protected $logger;
protected ?LoggerInterface $logger = null;

/**
* Sets a logger.
Expand Down
36 changes: 18 additions & 18 deletions system/ThirdParty/PSR/Log/LoggerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,104 +22,104 @@ interface LoggerInterface
/**
* System is unusable.
*
* @param string $message
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*/
public function emergency($message, array $context = array());
public function emergency(string|\Stringable $message, array $context = []);

/**
* Action must be taken immediately.
*
* Example: Entire website down, database unavailable, etc. This should
* trigger the SMS alerts and wake you up.
*
* @param string $message
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*/
public function alert($message, array $context = array());
public function alert(string|\Stringable $message, array $context = []);

/**
* Critical conditions.
*
* Example: Application component unavailable, unexpected exception.
*
* @param string $message
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*/
public function critical($message, array $context = array());
public function critical(string|\Stringable $message, array $context = []);

/**
* Runtime errors that do not require immediate action but should typically
* be logged and monitored.
*
* @param string $message
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*/
public function error($message, array $context = array());
public function error(string|\Stringable $message, array $context = []);

/**
* Exceptional occurrences that are not errors.
*
* Example: Use of deprecated APIs, poor use of an API, undesirable things
* that are not necessarily wrong.
*
* @param string $message
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*/
public function warning($message, array $context = array());
public function warning(string|\Stringable $message, array $context = []);

/**
* Normal but significant events.
*
* @param string $message
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*/
public function notice($message, array $context = array());
public function notice(string|\Stringable $message, array $context = []);

/**
* Interesting events.
*
* Example: User logs in, SQL logs.
*
* @param string $message
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*/
public function info($message, array $context = array());
public function info(string|\Stringable $message, array $context = []);

/**
* Detailed debug information.
*
* @param string $message
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*/
public function debug($message, array $context = array());
public function debug(string|\Stringable $message, array $context = []);

/**
* Logs with an arbitrary level.
*
* @param mixed $level
* @param string $message
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*
* @throws \Psr\Log\InvalidArgumentException
*/
public function log($level, $message, array $context = array());
public function log($level, string|\Stringable $message, array $context = []);
}
Loading

0 comments on commit ec661ef

Please sign in to comment.