public void log(final DriverEventCode code, final DirectBuffer buffer, final int offset, final int length)
    {
        if (DriverComponentLogger.ENABLED_EVENTS.contains(code))
        {
            final int captureLength = captureLength(length);
            final int encodedLength = encodedLength(captureLength);

            final ManyToOneRingBuffer ringBuffer = this.ringBuffer;
            final int index = ringBuffer.tryClaim(toEventCodeId(code), encodedLength);
            if (index > 0)
            {
                try
                {
                    encode((UnsafeBuffer)ringBuffer.buffer(), index, captureLength, length, buffer, offset);
                }
                finally
                {
                    ringBuffer.commit(index);
                }
            }
        }
    }
@Test
    void logIsNoOpIfEventIsNotEnabled()
    {
        buffer.setMemory(20, 100, (byte)5);

        logger.log(CMD_OUT_ERROR, buffer, 20, 100);

        assertEquals(0, logBuffer.getInt(lengthOffset(0), LITTLE_ENDIAN));
    }