Skip to content

[MonologBridge] remove deprecated features #22791

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
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
8 changes: 8 additions & 0 deletions src/Symfony/Bridge/Monolog/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
CHANGELOG
=========

4.0.0
-----

* the `$format`, `$dateFormat`, `$allowInlineLineBreaks`, and `$ignoreEmptyContextAndExtra`
constructor arguments of the `ConsoleFormatter` class have been removed, use
`$options` instead
* the `DebugHandler` class has been removed

3.3.0
-----

Expand Down
18 changes: 1 addition & 17 deletions src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,8 @@ class ConsoleFormatter implements FormatterInterface
* * colors: If true, the log string contains ANSI code to add color;
* * multiline: If false, "context" and "extra" are dumped on one line.
*/
public function __construct($options = array())
public function __construct(array $options = array())
{
// BC Layer
if (!is_array($options)) {
@trigger_error(sprintf('The constructor arguments $format, $dateFormat, $allowInlineLineBreaks, $ignoreEmptyContextAndExtra of "%s" are deprecated since 3.3 and will be removed in 4.0. Use $options instead.', self::class), E_USER_DEPRECATED);
$args = func_get_args();
$options = array();
if (isset($args[0])) {
$options['format'] = $args[0];
}
if (isset($args[1])) {
$options['date_format'] = $args[1];
}
if (isset($args[2])) {
$options['multiline'] = $args[2];
}
}

$this->options = array_replace(array(
'format' => self::SIMPLE_FORMAT,
'date_format' => self::SIMPLE_DATE,
Expand Down
64 changes: 0 additions & 64 deletions src/Symfony/Bridge/Monolog/Handler/DebugHandler.php

This file was deleted.

50 changes: 0 additions & 50 deletions src/Symfony/Bridge/Monolog/Tests/LoggerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,11 @@

use Monolog\Handler\TestHandler;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Monolog\Handler\DebugHandler;
use Symfony\Bridge\Monolog\Processor\DebugProcessor;
use Symfony\Bridge\Monolog\Logger;

class LoggerTest extends TestCase
{
/**
* @group legacy
*/
public function testGetLogsWithDebugHandler()
{
$handler = new DebugHandler();
$logger = new Logger(__METHOD__, array($handler));

$this->assertTrue($logger->error('error message'));
$this->assertSame(1, count($logger->getLogs()));
}

public function testGetLogsWithoutDebugProcessor()
{
$handler = new TestHandler();
Expand All @@ -40,43 +27,6 @@ public function testGetLogsWithoutDebugProcessor()
$this->assertSame(array(), $logger->getLogs());
}

/**
* @group legacy
*/
public function testCountErrorsWithDebugHandler()
{
$handler = new DebugHandler();
$logger = new Logger(__METHOD__, array($handler));

$this->assertTrue($logger->debug('test message'));
$this->assertTrue($logger->info('test message'));
$this->assertTrue($logger->notice('test message'));
$this->assertTrue($logger->warning('test message'));

$this->assertTrue($logger->error('test message'));
$this->assertTrue($logger->critical('test message'));
$this->assertTrue($logger->alert('test message'));
$this->assertTrue($logger->emergency('test message'));

$this->assertSame(4, $logger->countErrors());
}

/**
* @group legacy
*/
public function testGetLogsWithDebugHandler2()
{
$logger = new Logger('test');
$logger->pushHandler(new DebugHandler());

$logger->addInfo('test');
$this->assertCount(1, $logger->getLogs());
list($record) = $logger->getLogs();

$this->assertEquals('test', $record['message']);
$this->assertEquals(Logger::INFO, $record['priority']);
}

public function testCountErrorsWithoutDebugProcessor()
{
$handler = new TestHandler();
Expand Down