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

Allow psr/log v3 #1184

Merged
merged 1 commit into from Feb 3, 2022
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 @@ -19,7 +19,7 @@
"php": "^7.3 || ^8.0",
"ext-json": ">=1.3.7",
"ezimuel/ringphp": "^1.1.2",
"psr/log": "^1|^2"
"psr/log": "^1|^2|^3"
},
"require-dev": {
"ext-yaml": "*",
Expand Down
2 changes: 1 addition & 1 deletion src/Elasticsearch/Common/EmptyLogger.php
Expand Up @@ -32,7 +32,7 @@ class EmptyLogger extends AbstractLogger implements LoggerInterface
/**
* {@inheritDoc}
*/
public function log($level, $message, array $context = [])
public function log($level, $message, array $context = []): void
{
return;
}
Expand Down
47 changes: 3 additions & 44 deletions tests/Elasticsearch/Tests/ClientBuilder/ArrayLogger.php
Expand Up @@ -17,57 +17,16 @@

namespace Elasticsearch\Tests\ClientBuilder;

use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
use Psr\Log\AbstractLogger;

class ArrayLogger implements LoggerInterface
class ArrayLogger extends AbstractLogger
{
/**
* @var mixed[]
*/
public $output = [];

public function emergency($message, array $context = array())
{
$this->log(LogLevel::EMERGENCY, $message, $context);
}

public function alert($message, array $context = array())
{
$this->log(LogLevel::ALERT, $message, $context);
}

public function critical($message, array $context = array())
{
$this->log(LogLevel::CRITICAL, $message, $context);
}

public function error($message, array $context = array())
{
$this->log(LogLevel::ERROR, $message, $context);
}

public function warning($message, array $context = array())
{
$this->log(LogLevel::WARNING, $message, $context);
}

public function notice($message, array $context = array())
{
$this->log(LogLevel::NOTICE, $message, $context);
}

public function info($message, array $context = array())
{
$this->log(LogLevel::INFO, $message, $context);
}

public function debug($message, array $context = array())
{
$this->log(LogLevel::DEBUG, $message, $context);
}

public function log($level, $message, array $context = array())
public function log($level, $message, array $context = array()): void
{
$this->output[] = sprintf("%s: %s %s", $level, $message, json_encode($context));
}
Expand Down