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

How about use toString() to print log ? #118

Closed
HJ1AN opened this issue Sep 29, 2017 · 3 comments
Closed

How about use toString() to print log ? #118

HJ1AN opened this issue Sep 29, 2017 · 3 comments
Milestone

Comments

@HJ1AN
Copy link

HJ1AN commented Sep 29, 2017

For example:

logEngineParameters() in class DefaultRulesEngine

private void logEngineParameters() {
    LOGGER.info("Rule priority threshold: {}",
        parameters.getPriorityThreshold());
    LOGGER.info("Skip on first applied rule: {}",
        parameters.isSkipOnFirstAppliedRule());
    LOGGER.info("Skip on first non triggered rule: {}",
        parameters.isSkipOnFirstNonTriggeredRule());
    LOGGER.info("Skip on first failed rule: {}",
        parameters.isSkipOnFirstFailedRule());
    LOGGER.info("Skip on missing fact: {}",
        parameters.isSkipOnMissingFact());
}

It just print all properties of RulesEngineParameters, so maybe override toString() is briefer, like:

@Override
public String toString() {
    return "RulesEngineParameters{" +
            "skipOnFirstAppliedRule=" + skipOnFirstAppliedRule +
            ", skipOnFirstNonTriggeredRule=" + skipOnFirstNonTriggeredRule +
            ", skipOnFirstFailedRule=" + skipOnFirstFailedRule +
            ", skipOnMissingFact=" + skipOnMissingFact +
            ", priorityThreshold=" + priorityThreshold +
            '}';
}

and use it as:

LOGGER.info(parameters.toString());

the toString() above is create by IDEA, we can set another format. The same way to Rules and Facts.

What do you think about @benas ?

@fmbenhassine
Copy link
Member

Yes, good idea.

You can do it on the master branch without a PR.

Thank you!

@HJ1AN
Copy link
Author

HJ1AN commented Sep 29, 2017

Ok, I will finish it later.

@fmbenhassine
Copy link
Member

@wg1j This is done. Thanks!

@fmbenhassine fmbenhassine added this to the v3.1 milestone Oct 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants