fix: Use self-defined logging level instead of org.slf4j.event.Level #3796
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.
#3775
This PR introduces a self-defined
LogLevel
enum that can be used to get or set the logging level. The reason we need this is thatorg.slf4j.event.Level
makes Spoon backwards-incompatible with libraries that usesslf4j-api < 1.7.15
. Which is not good. I've tested this locally and it fixes the test errors in Casper, as mentioned in #3775.This is a breaking change, as the return type of
Environment.getLevel()
is changed. #I purposefully changed the name of the type fromLevel
toLogLevel
to make this more evident. #3755 was in fact also breaking, as theorg.slf4j.event.Level
is not the same as the previousLevel
type fromlog4j
. With this change, however, we won't have breakage again, as we now define the type ourselves.I have two more thoughts on this.
Environment.get/setLevel()
toEnvironment.get/setLogLevel()
. These names are more descriptive ("level" is obvious in a logging framework, but not in a metaprogramming library), and also make the breaking change more obvious.