class LoggingSerializer implements Serializer<T> {

  @Override
  public byte[] serialize(final String topic, final T data) {
    try {
      return delegate.serialize(topic, data);
    } catch (final RuntimeException e) {
      processingLogger.error(new SerializationError<>(e, Optional.of(data), topic, isKey));
      throw e;
    }
  }

  public  LoggingSerializer(
      final Serializer<T> delegate,
      final ProcessingLogger processingLogger
  );

}