-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue-143: Implement Pretty Printing #173
Conversation
Hi @SlyngDK IDK could you please approve running of the workflows? This would make use of your extension easier in development environments where a formatted log output is handy. Thank-you. |
Hi @SlyngDK is this PR of any interest? |
1 similar comment
Hi @SlyngDK is this PR of any interest? |
I remember i tested, but was not formatted pretty as expected, maybe only one of the formatters. Also the testing not check the pretty formatting is done. |
Hi @SlyngDK
"pretty print" is only supported for JSON
The tests do check the if "pretty formatting" is done. See the change here. See |
As an example. Test (the most complex in the suite)
|
private static final JsonFactory jsonb = new JsonbJsonFactory(); | ||
private static final JsonFactory jackson = new JacksonJsonFactory(); | ||
private static final ObjectMapper mapper = new ObjectMapper(); | ||
private final JsonFactory jsonb = new JsonbJsonFactory(prettyPrint()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the way the test is created. And the test should not format the output, because what are you then running your test against, not the output of the actual JsonFormatter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, fair enough.
I had tried to keep duplication to a minimum.
The JsonGenerator
in quarkus-logging-json
delegates "pretty printing" to their underlying JSON library and as such the format for the pretty printed JSON differs between the two (line breaks, indenting and spacing). I added the format(..)
method (and related code) around the expected value so that the test could format the expected value with the underlying JSON library thus avoiding duplicating the literal values for the different JSON libraries.
I've added a new commit removing that and duplicating the literal expected values for each JsonGenerator
.
This is your project and I respect that. I missed being able to "pretty print" when using it so thought I'd try adding the missing implementation. I'm happy to adhere to your requirements, guidelines etc. I think having the missing implementation remains a useful addition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SlyngDK Would you like me to make any further changes?
Closing. It seems this will never be merged. |
See #143