Skip to content

[MonologBridge] Monolog 2 compatibility #27905

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

Merged
merged 1 commit into from
Jul 8, 2019
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"doctrine/reflection": "~1.0",
"doctrine/doctrine-bundle": "^1.5|^2.0",
"masterminds/html5": "^2.6",
"monolog/monolog": "~1.11",
"monolog/monolog": "^1.11|^2",
"nyholm/psr7": "^1.0",
"ocramius/proxy-manager": "^2.1",
"php-http/httplug": "^1.0|^2.0",
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Bridge/Monolog/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CHANGELOG
-----

* The methods `DebugProcessor::getLogs()`, `DebugProcessor::countErrors()`, `Logger::getLogs()` and `Logger::countErrors()` have a new `$request` argument.
* Added support for Monolog 2.

4.4.0
-----
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function onKernelResponse(ResponseEvent $event)
/**
* {@inheritdoc}
*/
protected function sendHeader($header, $content)
protected function sendHeader($header, $content): void
{
if (!$this->sendHeaders) {
return;
Expand Down
11 changes: 6 additions & 5 deletions src/Symfony/Bridge/Monolog/Handler/ConsoleHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Bridge\Monolog\Handler;

use Monolog\Formatter\FormatterInterface;
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\AbstractProcessingHandler;
use Monolog\Logger;
Expand Down Expand Up @@ -74,15 +75,15 @@ public function __construct(OutputInterface $output = null, bool $bubble = true,
/**
* {@inheritdoc}
*/
public function isHandling(array $record)
public function isHandling(array $record): bool
{
return $this->updateLevel() && parent::isHandling($record);
}

/**
* {@inheritdoc}
*/
public function handle(array $record)
public function handle(array $record): bool
{
// we have to update the logging level each time because the verbosity of the
// console output might have changed in the meantime (it is not immutable)
Expand All @@ -100,7 +101,7 @@ public function setOutput(OutputInterface $output)
/**
* Disables the output.
*/
public function close()
public function close(): void
{
$this->output = null;

Expand Down Expand Up @@ -143,7 +144,7 @@ public static function getSubscribedEvents()
/**
* {@inheritdoc}
*/
protected function write(array $record)
protected function write(array $record): void
{
// at this point we've determined for sure that we want to output the record, so use the output's own verbosity
$this->output->write((string) $record['formatted'], false, $this->output->getVerbosity());
Expand All @@ -152,7 +153,7 @@ protected function write(array $record)
/**
* {@inheritdoc}
*/
protected function getDefaultFormatter()
protected function getDefaultFormatter(): FormatterInterface
{
if (!class_exists(CliDumper::class)) {
return new LineFormatter();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct(RequestStack $requestStack, array $exclusions, $acti
$this->exclusions = $exclusions;
}

public function isHandlerActivated(array $record)
public function isHandlerActivated(array $record): bool
{
$isActivated = parent::isHandlerActivated($record);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct(RequestStack $requestStack, array $excludedUrls, $ac
$this->blacklist = '{('.implode('|', $excludedUrls).')}i';
}

public function isHandlerActivated(array $record)
public function isHandlerActivated(array $record): bool
{
$isActivated = parent::isHandlerActivated($record);

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Monolog/Handler/FirePHPHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function onKernelResponse(ResponseEvent $event)
/**
* {@inheritdoc}
*/
protected function sendHeader($header, $content)
protected function sendHeader($header, $content): void
{
if (!self::$sendHeaders) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct(string $host, int $level = Logger::DEBUG, bool $bubb
/**
* {@inheritdoc}
*/
public function handle(array $record)
public function handle(array $record): bool
{
if (!$this->isHandling($record)) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Monolog/Handler/SwiftMailerHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function onCliTerminate(ConsoleTerminateEvent $event)
/**
* {@inheritdoc}
*/
protected function send($content, array $records)
protected function send($content, array $records): void
{
parent::send($content, $records);

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Monolog/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function clear()
/**
* {@inheritdoc}
*/
public function reset()
public function reset(): void
{
$this->clear();

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Monolog/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
],
"require": {
"php": "^7.2.9",
"monolog/monolog": "~1.19",
"monolog/monolog": "^1.19|^2",
"symfony/service-contracts": "^1.1",
"symfony/http-kernel": "^4.4|^5.0"
},
Expand Down