Closed acodili-jg closed 1 year ago
For future reference (don't do anything about this now) (and it's not really your fault), but this PR would probably be better suited on its original branch. I've been meaning to solidify the workflow around here for some time now. (adding that to my TODOs rq)
On another note, looks reasonable.
I guess #104 wasn't a mistake; and sure, I'll check Discord.
Could you integrate this into relevant places in the code? As well as make a variant of this available for non-error logging? Computational offload inside Engine.java
for logging is something I cheaply implemented before. However, a more structured approach like this one would do it some good.
Sure. Though I'll be closing this one (later) to make a new PR as this PR's branch is actually based on master
and it seems there is newer code on octree-testing
that I might miss.
TLDR;
This update introduces
checkError(Supplier<String>)
for lazily built log messages.The Issue:
In the current code, messages passed to
checkError(String)
are, potentially complex and eagerly built, string. However, this approach may unnecessarily create messages that may never be used due to the waycheckError(Consumer<String>)
works.The Proposed Solution:
checkError(Supplier<String>)
tries to address the issue by providing a way to defer the message building when it's needed, saving unnecessary processing when no errors occur.Alternative Approach:
As an alternative, the underlying logger's functionality can be used directly. One interpretation could be to discourage the use of
checkError(String)
in favor ofcheckError(Consumer<String>)
and do the logging there, though it may result in duplicated code.I would really welcome feedback as I don't understand why I'm so hesitant in making this pull request.
Transparency
ChatGPT helped in rewriting the final description.
Original description.
> ### TLDR; > > `checkErrors(Supplier> > `checkErrors(Consumer
ChatGPT's suggestion.
> ### TLDR; > > This update introduces improvements to how errors are handled and logged in the `ALUtils` class. > >> > #### The Issue: > > In the current code, error messages are logged using a fixed string format. However, this approach has some limitations, as it may log unnecessary messages or build complex error strings even when there are no errors. > > #### The Proposed Solution: > > To address these limitations, we are introducing a new and more flexible method called `checkError(Supplier