carterkozak commented on a change in pull request #444:
URL: https://github.com/apache/logging-log4j2/pull/444#discussion_r532612187



##########
File path: 
log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/util/JsonWriter.java
##########
@@ -572,6 +565,10 @@ public void writeString(
 
     }
 
+    public void writeAsString(Object object) {

Review comment:
       > I don't think this should be public. I would rather go with the old 
approach, where ParameterizedMessage.deepToString() was explicit. This method 
doesn't provide, IMHO, anything, except saving us to type a couple more 
characters.
   
   The issue I ran into was using deepToString efficiently requires a (static, 
to avoid garbage creation) `BiConsumer<StringBuilder, Object>` emitter, which 
originally I defined in each class that had a 'stringafy' option. I ended up 
creating a utility function in the writer to make it easier, but it doesn't 
make much difference either way.
   
   I agree that object->string formatting may be out of scope for the 
JsonWriter class, and could occur at a higher level.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to