ServerLogHandler example

use Symfony\Bridge\Monolog\Handler\ServerLogHandler;
use Symfony\Bridge\Monolog\Tests\RecordFactory;
use Symfony\Component\VarDumper\Cloner\Data;

/** * Tests the ServerLogHandler. */
class ServerLogHandlerTest extends TestCase
{
    public function testFormatter()
    {
        $handler = new ServerLogHandler('tcp://127.0.0.1:9999');
        $this->assertInstanceOf(VarDumperFormatter::class$handler->getFormatter());

        $formatter = new JsonFormatter();
        $handler->setFormatter($formatter);
        $this->assertSame($formatter$handler->getFormatter());
    }

    public function testIsHandling()
    {
        $handler = new ServerLogHandler('tcp://127.0.0.1:9999', Logger::INFO);
        $this->assertFalse($handler->isHandling(RecordFactory::create(Logger::DEBUG)), '->isHandling returns false when no output is set');
    }
Home | Imprint | This part of the site doesn't use cookies.