Updated Boolean.pm to evaluate filter in a single eval. #48
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.
In using the Boolean filter I noticed that it wasn't shortcutting in evaluating the logic parameter. It is hoped that with this update the boolean logic will be evaluated once instead of in pieces (where all pieces get evaluated).
A simple test conf:
log4perl.category.test = DEBUG, Screen
log4perl.filter.Debug = Log::Log4perl::Filter::LevelMatch
log4perl.filter.Debug.LevelToMatch = DEBUG
log4perl.filter.Debug.AcceptOnMatch = true
log4perl.filter.Info = Log::Log4perl::Filter::LevelMatch
log4perl.filter.Info.LevelToMatch = INFO
log4perl.filter.Info.AcceptOnMatch = true
log4perl.filter.Boolean = Log::Log4perl::Filter::Boolean
log4perl.filter.Boolean.logic = Debug && Info
log4perl.appender.Screen = Log::Log4perl::Appender::Screen
log4perl.appender.Screen.layout = Log::Log4perl::Layout::SimpleLayout
log4perl.appender.Screen.Filter = Boolean
With this revision $logger->info() will hit LevelMatch::ok() once where previously it would've hit it twice (even though the logic should prevent the second call from happening.