Skip to content

Commit 4667a98

Browse files
author
Erin
committed
Added more logging to AvroUtils
1 parent b0d63bf commit 4667a98

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

schemas-core/src/main/java/org/cedar/schemas/avro/util/AvroUtils.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,15 @@ public static <T extends GenericRecord> T jsonToAvroLenient(InputStream json, Sc
9999

100100
public static <T extends IndexedRecord> T mapToAvro(Map input, Class<T> avroClass) {
101101
if (input == null) { return null; }
102-
log.debug("Transforming a map of type to Avro type [" + avroClass + "]");
102+
log.debug("Transforming a type map to Avro type [" + avroClass + "]");
103103
try {
104104
T instance = avroClass.getDeclaredConstructor().newInstance();
105105
Schema schema = instance.getSchema();
106106
List<Schema.Field> fields = schema.getFields();
107+
log.debug("Schema "+schema.getName()+" has fields "+fields);
107108
fields.forEach(f -> {
108109
Object value = input.containsKey(f.name()) ? input.get(f.name()) : f.defaultVal();
110+
log.debug("Input "+(input.containsKey(f.name()) ? "contains" : "does NOT contain")+" field "+f.name());
109111
instance.put(f.pos(), coerceValueForSchema(value, f.schema()));
110112
});
111113
return instance;

0 commit comments

Comments
 (0)