Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add monolog/monolog 3 support #75

Merged
merged 4 commits into from Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -28,7 +28,7 @@
"league/uri": "^5.0|^6.5",
"mf2/mf2": "^0.4",
"ml/json-ld": "^1.2",
"monolog/monolog": "^1.24 || ^2",
"monolog/monolog": "^1.24 || ^2 || ^3",
"psr/cache": "^1.0|^2|^3",
"psr/log": "^1.1|^2|^3",
"symfony/cache": "^4.0|^5.0|^6.0"
Expand Down
1 change: 1 addition & 0 deletions src/Micrometa/Domain/Item/PropertyList.php
Expand Up @@ -122,6 +122,7 @@ public function next(): void
*
* @return mixed IRI key
*/
#[\ReturnTypeWillChange]
blankse marked this conversation as resolved.
Show resolved Hide resolved
public function key()
{
return $this->names[$this->cursor];
Expand Down
6 changes: 5 additions & 1 deletion src/Micrometa/Infrastructure/Logger/ExceptionLogger.php
Expand Up @@ -38,6 +38,7 @@

use Jkphl\Micrometa\Ports\Exceptions\RuntimeException;
use Monolog\Handler\NullHandler;
use Monolog\Level;
use Monolog\Logger;
use Monolog\ResettableInterface;
use Psr\Log\LoggerInterface;
Expand Down Expand Up @@ -84,6 +85,9 @@ public function __construct($threshold = Logger::ERROR)
public function log($level, $message, array $context = [])
{
$level = Logger::toMonologLevel($level);
if ($level instanceof Level) {
$level = $level->value;
}

if ($this->isTriggered($level)) {
throw $this->getContextException($context) ?: new RuntimeException($message, $level);
Expand Down Expand Up @@ -117,7 +121,7 @@ protected function getContextException(array $context)
$context['exception'] : null;
}

public function reset()
public function reset(): void
{
$this->decoratedLogger->reset();
}
Expand Down
2 changes: 2 additions & 0 deletions src/Micrometa/Ports/Item/ItemList.php
Expand Up @@ -80,6 +80,7 @@ public function __construct(array $items = [])
* @return ItemInterface Item
* @api
*/
#[\ReturnTypeWillChange]
public function current()
{
return $this->items[$this->pointer];
Expand Down Expand Up @@ -150,6 +151,7 @@ public function offsetExists($offset): bool
* @return ItemInterface Item
* @api
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->items[$offset];
Expand Down