[MonologBundle] Changed the default bubbling behavior. Fixes #1268

This commit is contained in:
Christophe Coevoet 2011-06-10 19:42:03 +02:00
parent ce8d6d06e2
commit 5458baf465
3 changed files with 21 additions and 18 deletions

View File

@ -9,6 +9,9 @@ timeline closely anyway.
beta4 to beta5
--------------
* The stack of Monolog handlers now bubbles the records by default. To stop
the propagation you need to configure the bubbling explicitly.
* Expanded the SerializerInterface, while reducing the number of public
methods in the Serializer class itself breaking BC and adding component
specific Exception classes.
@ -155,16 +158,16 @@ beta2 to beta3
* The settings under `framework.annotations` have changed slightly:
Before:
framework:
annotations:
cache: file
file_cache:
debug: true
dir: /foo
After:
framework:
annotations:
cache: file
@ -275,7 +278,7 @@ class AcmeEntity
}
```
* The config under `framework.validation.annotations` has been removed and was
* The config under `framework.validation.annotations` has been removed and was
replaced with a boolean flag `framework.validation.enable_annotations` which
defaults to false.
@ -422,7 +425,7 @@ class AcmeEntity
'allow_add' => true,
'allow_delete' => true,
));
* `Request::hasSession()` has been renamed to `Request::hasPreviousSession()`. The
method `hasSession()` still exists, but only checks if the request contains a
session object, not if the session was started in a previous request.
@ -438,10 +441,10 @@ class AcmeEntity
* Serializer: The `$properties` argument has been dropped from all interfaces.
* Form: Renamed option value `text` of `widget` option of the `date` type was
* Form: Renamed option value `text` of `widget` option of the `date` type was
renamed to `single-text`. `text` indicates to use separate text boxes now
(like for the `time` type).
* Form: Renamed view variable `name` to `full_name`. The variable `name` now
contains the local, short name (equivalent to `$form->getName()`).

View File

@ -57,7 +57,7 @@ class Configuration implements ConfigurationInterface
->scalarNode('id')->end()
->scalarNode('priority')->defaultValue(0)->end()
->scalarNode('level')->defaultValue('DEBUG')->end()
->booleanNode('bubble')->defaultFalse()->end()
->booleanNode('bubble')->defaultTrue()->end()
->scalarNode('path')->defaultValue('%kernel.logs_dir%/%kernel.environment%.log')->end() // stream and rotating
->scalarNode('ident')->defaultFalse()->end() // syslog
->scalarNode('facility')->defaultValue('user')->end() // syslog

View File

@ -32,7 +32,7 @@ class MonologExtensionTest extends TestCase
$handler = $container->getDefinition('monolog.handler.main');
$this->assertDICDefinitionClass($handler, '%monolog.handler.stream.class%');
$this->assertDICConstructorArguments($handler, array('%kernel.logs_dir%/%kernel.environment%.log', \Monolog\Logger::DEBUG, false));
$this->assertDICConstructorArguments($handler, array('%kernel.logs_dir%/%kernel.environment%.log', \Monolog\Logger::DEBUG, true));
}
public function testLoadWithCustomValues()
@ -40,7 +40,7 @@ class MonologExtensionTest extends TestCase
$container = new ContainerBuilder();
$loader = new MonologExtension();
$loader->load(array(array('handlers' => array('custom' => array('type' => 'stream', 'path' => '/tmp/symfony.log', 'bubble' => true, 'level' => 'ERROR')))), $container);
$loader->load(array(array('handlers' => array('custom' => array('type' => 'stream', 'path' => '/tmp/symfony.log', 'bubble' => false, 'level' => 'ERROR')))), $container);
$this->assertTrue($container->hasDefinition('monolog.logger'));
$this->assertTrue($container->hasDefinition('monolog.handler.custom'));
@ -49,7 +49,7 @@ class MonologExtensionTest extends TestCase
$handler = $container->getDefinition('monolog.handler.custom');
$this->assertDICDefinitionClass($handler, '%monolog.handler.stream.class%');
$this->assertDICConstructorArguments($handler, array('/tmp/symfony.log', \Monolog\Logger::ERROR, true));
$this->assertDICConstructorArguments($handler, array('/tmp/symfony.log', \Monolog\Logger::ERROR, false));
}
public function testLoadWithSeveralHandlers()
@ -58,7 +58,7 @@ class MonologExtensionTest extends TestCase
$loader = new MonologExtension();
$loader->load(array(array('handlers' => array(
'custom' => array('type' => 'stream', 'path' => '/tmp/symfony.log', 'bubble' => true, 'level' => 'ERROR'),
'custom' => array('type' => 'stream', 'path' => '/tmp/symfony.log', 'bubble' => false, 'level' => 'ERROR'),
'main' => array('type' => 'fingers_crossed', 'action_level' => 'ERROR', 'handler' => 'nested'),
'nested' => array('type' => 'stream')
))), $container);
@ -73,11 +73,11 @@ class MonologExtensionTest extends TestCase
$handler = $container->getDefinition('monolog.handler.custom');
$this->assertDICDefinitionClass($handler, '%monolog.handler.stream.class%');
$this->assertDICConstructorArguments($handler, array('/tmp/symfony.log', \Monolog\Logger::ERROR, true));
$this->assertDICConstructorArguments($handler, array('/tmp/symfony.log', \Monolog\Logger::ERROR, false));
$handler = $container->getDefinition('monolog.handler.main');
$this->assertDICDefinitionClass($handler, '%monolog.handler.fingers_crossed.class%');
$this->assertDICConstructorArguments($handler, array(new Reference('monolog.handler.nested'), \Monolog\Logger::ERROR, 0, false, true));
$this->assertDICConstructorArguments($handler, array(new Reference('monolog.handler.nested'), \Monolog\Logger::ERROR, 0, true, true));
}
public function testLoadWithOverwriting()
@ -87,7 +87,7 @@ class MonologExtensionTest extends TestCase
$loader->load(array(
array('handlers' => array(
'custom' => array('type' => 'stream', 'path' => '/tmp/symfony.log', 'bubble' => true, 'level' => 'ERROR'),
'custom' => array('type' => 'stream', 'path' => '/tmp/symfony.log', 'bubble' => false, 'level' => 'ERROR'),
'main' => array('type' => 'fingers_crossed', 'action_level' => 'ERROR', 'handler' => 'nested'),
'nested' => array('type' => 'stream')
)),
@ -110,7 +110,7 @@ class MonologExtensionTest extends TestCase
$handler = $container->getDefinition('monolog.handler.main');
$this->assertDICDefinitionClass($handler, '%monolog.handler.fingers_crossed.class%');
$this->assertDICConstructorArguments($handler, array(new Reference('monolog.handler.nested'), \Monolog\Logger::ERROR, 0, false, true));
$this->assertDICConstructorArguments($handler, array(new Reference('monolog.handler.nested'), \Monolog\Logger::ERROR, 0, true, true));
}
public function testLoadWithNewAtEnd()
@ -125,7 +125,7 @@ class MonologExtensionTest extends TestCase
'nested' => array('type' => 'stream')
)),
array('handlers' => array(
'custom' => array('type' => 'stream', 'path' => '/tmp/symfony.log', 'bubble' => true, 'level' => 'WARNING'),
'custom' => array('type' => 'stream', 'path' => '/tmp/symfony.log', 'bubble' => false, 'level' => 'WARNING'),
'new' => array('type' => 'stream', 'path' => '/tmp/monolog.log', 'bubble' => true, 'level' => 'ERROR'),
))
), $container);
@ -177,7 +177,7 @@ class MonologExtensionTest extends TestCase
$handler = $container->getDefinition('monolog.handler.main');
$this->assertDICDefinitionClass($handler, '%monolog.handler.buffer.class%');
$this->assertDICConstructorArguments($handler, array(new Reference('monolog.handler.nested'), 0, \Monolog\Logger::INFO, false));
$this->assertDICConstructorArguments($handler, array(new Reference('monolog.handler.nested'), 0, \Monolog\Logger::INFO, true));
$handler = $container->getDefinition('monolog.handler.first');
$this->assertDICDefinitionClass($handler, '%monolog.handler.rotating_file.class%');