public void writeTo(final RLPOutput out, final boolean compacted) {
    out.startList();
    out.writeBytes(logger);
    if (compacted) {
      out.writeList(topics, (topic, listOut) -> encodeTrimmedData(listOut, topic));
      encodeTrimmedData(out, data);
    } else {
      out.writeList(topics, (topic, listOut) -> listOut.writeBytes(topic));
      out.writeBytes(data);
    }
    out.endList();
  }
Writes the log entry to the provided RLP output.

@param out the output in which to encode the log entry.
@param compacted whether to compact the rlp log entry by trimming leading zeros on topics and
    data.
evm/src/main/java/org/hyperledger/besu/evm/log/Log.java