ProcessIdProcessor example


        $handler = new ServerLogHandler('tcp://127.0.0.1:9999');
        $this->assertInstanceOf(VarDumperFormatter::class$handler->getFormatter(),
            '->getFormatter returns VarDumperFormatter by default'
        );
    }

    public function testWritingAndFormatting()
    {
        $host = 'tcp://127.0.0.1:9999';
        $handler = new ServerLogHandler($host, Logger::INFO, false);
        $handler->pushProcessor(new ProcessIdProcessor());

        $infoRecord = RecordFactory::create(Logger::INFO, 'My info message', 'app', datetime: new \DateTimeImmutable('2013-05-29 16:21:54'));

        $socket = stream_socket_server($host$errno$errstr);
        $this->assertIsResource($socketsprintf('Server start failed on "%s": %s %s.', $host$errstr$errno));

        $this->assertTrue($handler->handle($infoRecord), 'The handler finished handling the log as bubble is false.');

        $sockets = [(int) $socket => $socket];
        $write = [];

        
Home | Imprint | This part of the site doesn't use cookies.