[MonologBundle] Added FirePHPHandler support
This commit is contained in:
parent
3bca4b73e5
commit
f4d1196666
@ -123,6 +123,14 @@ class MonologExtension extends Extension
|
|||||||
));
|
));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'firephp':
|
||||||
|
$definition->setArguments(array(
|
||||||
|
$handler['level'],
|
||||||
|
$handler['bubble'],
|
||||||
|
));
|
||||||
|
$definition->addTag('kernel.listener', array('event' => 'onCoreResponse'));
|
||||||
|
break;
|
||||||
|
|
||||||
case 'rotating_file':
|
case 'rotating_file':
|
||||||
if (!isset($handler['path'])) {
|
if (!isset($handler['path'])) {
|
||||||
$handler['path'] = '%kernel.logs_dir%/%kernel.environment%.log';
|
$handler['path'] = '%kernel.logs_dir%/%kernel.environment%.log';
|
||||||
|
58
src/Symfony/Bundle/MonologBundle/Logger/FirePHPHandler.php
Executable file
58
src/Symfony/Bundle/MonologBundle/Logger/FirePHPHandler.php
Executable file
@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Bundle\MonologBundle\Logger;
|
||||||
|
|
||||||
|
use Monolog\Handler\FirePHPHandler as BaseFirePHPHandler;
|
||||||
|
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FirePHPHandler.
|
||||||
|
*
|
||||||
|
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
*/
|
||||||
|
class FirePHPHandler extends BaseFirePHPHandler
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $headers = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Response
|
||||||
|
*/
|
||||||
|
private $response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
protected function sendHeader($header, $content)
|
||||||
|
{
|
||||||
|
if ($this->response) {
|
||||||
|
$this->response->headers->set($header, $content);
|
||||||
|
} else {
|
||||||
|
$this->headers[$header] = $content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the headers to the response once it's created
|
||||||
|
*/
|
||||||
|
public function onCoreResponse(FilterResponseEvent $event)
|
||||||
|
{
|
||||||
|
$this->response = $event->getResponse();
|
||||||
|
foreach ($this->headers as $header => $content) {
|
||||||
|
$this->response->headers->set($header, $content);
|
||||||
|
}
|
||||||
|
$this->headers = array();
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,7 @@
|
|||||||
<parameter key="monolog.handler.syslog.class">Monolog\Handler\SyslogHandler</parameter>
|
<parameter key="monolog.handler.syslog.class">Monolog\Handler\SyslogHandler</parameter>
|
||||||
<parameter key="monolog.handler.null.class">Monolog\Handler\NullHandler</parameter>
|
<parameter key="monolog.handler.null.class">Monolog\Handler\NullHandler</parameter>
|
||||||
<parameter key="monolog.handler.test.class">Monolog\Handler\TestHandler</parameter>
|
<parameter key="monolog.handler.test.class">Monolog\Handler\TestHandler</parameter>
|
||||||
|
<parameter key="monolog.handler.firephp.class">Symfony\Bundle\MonologBundle\Logger\FirePHPHandler</parameter>
|
||||||
<parameter key="monolog.handler.debug.class">Symfony\Bundle\MonologBundle\Logger\DebugHandler</parameter>
|
<parameter key="monolog.handler.debug.class">Symfony\Bundle\MonologBundle\Logger\DebugHandler</parameter>
|
||||||
</parameters>
|
</parameters>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user