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

Logging: support lazy construction of message #4

Open
dtruebin opened this issue Nov 17, 2023 · 0 comments
Open

Logging: support lazy construction of message #4

dtruebin opened this issue Nov 17, 2023 · 0 comments

Comments

@dtruebin
Copy link

A frequent pattern of using com.devexperts.logging.Logging#debug(java.lang.String) is (example from dxfeed-api/src/main/java/com/dxfeed/ipf/live/InstrumentProfileCollector.java):

if (log.debugEnabled())
    log.debug("Removing " + debugString(entry.ip));

— this is supposedly done to avoid resource-intensive computation of message, which is justified, but can be considered boilerplate.

Raw log4j2 addresses this by providing lambda-accepting methods such as org.apache.logging.log4j.Logger#debug(org.apache.logging.log4j.util.Supplier<?>). It would be nice if com.devexperts.logging.Logging supported this as well.

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

No branches or pull requests

1 participant