Render Inspectable.
package com.yahoo.container.logging;
+import com.yahoo.data.access.Inspectable;
+import com.yahoo.data.access.Inspector;
+import com.yahoo.data.access.simple.JsonRender;
import com.yahoo.yolean.trace.TraceNode;
import com.yahoo.yolean.trace.TraceVisitor;
import com.fasterxml.jackson.core.JsonGenerator;
@@ -33,9 +36,18 @@ public class TraceRenderer extends TraceVisitor {
@Override
public void consume(Object object) throws IOException {
+ if (object instanceof Inspectable) {
+ renderInspectorDirect(((Inspectable) object).inspect());
+ } else {
generator.writeObject(object);
}
}
+ private void renderInspectorDirect(Inspector data) throws IOException {
+ StringBuilder intermediate = new StringBuilder();
+ JsonRender.render(data, intermediate, true);
+ generator.writeRawValue(intermediate.toString());
+ }
+ }
TraceRenderer(JsonGenerator generator, long basetime) {
this(generator, new Consumer(generator), basetime);
