Add full support for the SLF4J fluent logging API #408
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This implements #407. Changes:
TestLogger
class implements theLoggingEventAware
interface. This means that it has direct access to the logging event produced by the fluent logging API, so it can store it more correctly. This breaks compatibility with SLF4J versions prior to 2.0.0.LoggingEvent
class supports multiple markers. This is allowed by the fluent API.LoggingEvent
class stores the key/value pair list that can be generated fluent API.toString
,equals
, andhashCode
methods of theLoggingEvent
class have been updated to match the two changes above.TestLoggingEventBuilder
class can be used for fluently creatingLoggingEvent
instances for use as expected values. That method is necessary if the expected event has key/value pairs or multiple markers. The alternative would have been to exponentially add even more convenience build routines toLoggingEvent
. The existing ones are kept unchanged.LoggingEvent.toString()
have been adapted.BTW, I realized that there is nothing that prevents a logging event from having a null message, but
LoggingEvent.toString()
did not handle that. I have fixed it.