Skip to content
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

Add full support for the SLF4J fluent logging API #408

Merged
merged 1 commit into from
Jul 9, 2023

Conversation

karstenspang
Copy link

This implements #407. Changes:

  • The TestLogger class implements the LoggingEventAware 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.
  • The LoggingEvent class supports multiple markers. This is allowed by the fluent API.
  • The LoggingEvent class stores the key/value pair list that can be generated fluent API.
  • The toString, equals, and hashCode methods of the LoggingEvent class have been updated to match the two changes above.
  • The new TestLoggingEventBuilder class can be used for fluently creating LoggingEvent 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 to LoggingEvent. The existing ones are kept unchanged.
  • Test cases that rely on the exact format of the output of 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.

@codeclimate
Copy link

codeclimate bot commented Jul 8, 2023

Code Climate has analyzed commit 7472c28 and detected 0 issues on this pull request.

View more on Code Climate.

@valfirst valfirst linked an issue Jul 9, 2023 that may be closed by this pull request
@valfirst valfirst added this to the 3.0.0 milestone Jul 9, 2023
@valfirst valfirst merged commit 32f3257 into valfirst:master Jul 9, 2023
@valfirst
Copy link
Owner

valfirst commented Jul 9, 2023

@karstenspang thank you for your contribution!

@karstenspang karstenspang deleted the fluent branch July 10, 2023 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for fluent API
2 participants