BsonLogParam implements LogParam { String logValue() { if (bson == null) { return "null"; } else { try { return bson.toBsonDocument(null, registry).toJson(); } catch (CodecConfigurationException e) { return bson.toString(); } } } BsonLogParam(Bson bson, CodecRegistry registry); @Override void append(StringBuilder builder, Set<String> maskedFields, int maxParamLength);  }
@Test void logValue() { assertThat(new BsonLogParam(Filters.eq("field", TestUnregisteredEnum.V1), MongoClientSettings.getDefaultCodecRegistry()).logValue()) .contains("V1"); assertThat(new BsonLogParam(null, MongoClientSettings.getDefaultCodecRegistry()).logValue()) .isEqualTo("null"); }