Skip to content

Commit

Permalink
Merge pull request #88 from byan/psr-log
Browse files Browse the repository at this point in the history
Allow `psr/log:^2` and `psr/log:^3` installation
  • Loading branch information
Ocramius committed Feb 15, 2022
2 parents 550c3d8 + b9a5398 commit 4067c94
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 29 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"psr/http-message": "^1.0",
"psr/http-message-implementation": "^1.0",
"psr/http-server-handler": "^1.0",
"psr/log": "^1.0",
"psr/log": "^1.0 || ^2.0 || ^3.0",
"symfony/console": "^5.0 || ^6.0",
"webmozart/assert": "^1.9"
},
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions src/Log/Psr3AccessLogDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,71 +61,71 @@ public function logAccessForPsr7Resource(Request $request, ResponseInterface $re
/**
* {@inheritDoc}
*/
public function emergency($message, array $context = [])
public function emergency($message, array $context = []): void
{
$this->logger->emergency($message, $context);
}

/**
* {@inheritDoc}
*/
public function alert($message, array $context = [])
public function alert($message, array $context = []): void
{
$this->logger->alert($message, $context);
}

/**
* {@inheritDoc}
*/
public function critical($message, array $context = [])
public function critical($message, array $context = []): void
{
$this->logger->critical($message, $context);
}

/**
* {@inheritDoc}
*/
public function error($message, array $context = [])
public function error($message, array $context = []): void
{
$this->logger->error($message, $context);
}

/**
* {@inheritDoc}
*/
public function warning($message, array $context = [])
public function warning($message, array $context = []): void
{
$this->logger->warning($message, $context);
}

/**
* {@inheritDoc}
*/
public function notice($message, array $context = [])
public function notice($message, array $context = []): void
{
$this->logger->notice($message, $context);
}

/**
* {@inheritDoc}
*/
public function info($message, array $context = [])
public function info($message, array $context = []): void
{
$this->logger->info($message, $context);
}

/**
* {@inheritDoc}
*/
public function debug($message, array $context = [])
public function debug($message, array $context = []): void
{
$this->logger->debug($message, $context);
}

/**
* {@inheritDoc}
*/
public function log($level, $message, array $context = [])
public function log($level, $message, array $context = []): void
{
$this->logger->log($level, $message, $context);
}
Expand Down
27 changes: 9 additions & 18 deletions src/Log/StdoutLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,82 +31,73 @@ class StdoutLogger implements LoggerInterface
{
/**
* @param string $message
* @return void
*/
public function emergency($message, array $context = [])
public function emergency($message, array $context = []): void
{
$this->log(LogLevel::EMERGENCY, $message, $context);
}

/**
* @param string $message
* @return void
*/
public function alert($message, array $context = [])
public function alert($message, array $context = []): void
{
$this->log(LogLevel::ALERT, $message, $context);
}

/**
* @param string $message
* @return void
*/
public function critical($message, array $context = [])
public function critical($message, array $context = []): void
{
$this->log(LogLevel::CRITICAL, $message, $context);
}

/**
* @param string $message
* @return void
*/
public function error($message, array $context = [])
public function error($message, array $context = []): void
{
$this->log(LogLevel::ERROR, $message, $context);
}

/**
* @param string $message
* @return void
*/
public function warning($message, array $context = [])
public function warning($message, array $context = []): void
{
$this->log(LogLevel::WARNING, $message, $context);
}

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

/**
* @param string $message
* @return void
*/
public function info($message, array $context = [])
public function info($message, array $context = []): void
{
$this->log(LogLevel::INFO, $message, $context);
}

/**
* @param string $message
* @return void
*/
public function debug($message, array $context = [])
public function debug($message, array $context = []): void
{
$this->log(LogLevel::DEBUG, $message, $context);
}

/**
* @param mixed $level Generally a string from a LogLevel constant.
* @param string $message
* @return void
*/
public function log($level, $message, array $context = [])
public function log($level, $message, array $context = []): void
{
foreach ($context as $key => $value) {
$value = is_string($value) || is_array($value) ? $value : (string) $value;
Expand Down

0 comments on commit 4067c94

Please sign in to comment.