-
Notifications
You must be signed in to change notification settings - Fork 264
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
Externalize a handler to write json fields #878
Externalize a handler to write json fields #878
Conversation
|
||
private final JsonFactory factory; | ||
|
||
private JsonFieldWriter delegate = this; // default to this implementation |
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.
By implementing this interface directly you're exposing that implementation detail to the outside world because FastJsonHttpLogFormatter
is public. I'd hide that with a static inner class.
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.
Completely agree with that. In fact I was thinking that I should have followed that approach from the beginning.
public String format( | ||
final Precorrelation precorrelation, | ||
final HttpRequest request) throws IOException { | ||
public FastJsonHttpLogFormatter(final ObjectMapper mapper, |
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 guess this constructor is not covered by tests. If you follow my approach from above you get that for free, because you would actually use it then.
👍 |
I'm releasing this as 2.4.0 as we speak. Thanks for the contribution! 🎉 |
Allows to contribute with a custom JsonFieldWriter to have full freedom on how to write headers and body (naming and ordering).