@Override
    public void run(DiagnosticsLogWriter writer) {
        for (; ; ) {
            Object item = logQueue.poll();
            if (item == null) {
                return;
            }

            if (item instanceof LifecycleEvent event) {
                render(writer, event);
            } else if (item instanceof MembershipEvent event) {
                render(writer, event);
            } else if (item instanceof MigrationState state) {
                render(writer, state);
            } else if (item instanceof ReplicaMigrationEvent event) {
                render(writer, event);
            } else if (item instanceof ConnectionEvent event) {
                render(writer, event);
            } else if (item instanceof Version version) {
                render(writer, version);
            }
        }
    }
@Test
    public void testMembership() {
        HazelcastInstance instance = hzFactory.newHazelcastInstance(config);
        assertTrueEventually(() -> {
            plugin.run(logWriter);
            assertContains("MemberAdded[");
        });

        instance.shutdown();
        assertTrueEventually(() -> {
            plugin.run(logWriter);
            assertContains("MemberRemoved[");
        });
    }