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

Does it make sense that almost all logging statements are preceded by a condition? #57

Open
schakalakka opened this issue Jan 14, 2023 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@schakalakka
Copy link
Member

Example:

if (TPS_Logger.isLogging(HierarchyLogLevel.THREAD, SeverenceLogLevel.INFO)) {
          TPS_Logger.log(HierarchyLogLevel.THREAD, SeverenceLogLevel.INFO, "Assigning cars to households");
 }

Doesn't it log only if the LogLevel is activated anyway?

@schakalakka schakalakka added the question Further information is requested label Jan 14, 2023
@dkrajzew
Copy link
Member

Yeah, it only logs if the according level is set to true.

BUT: what does not count for this example, but for different others in the code is that the string to log is built, first. And that is done in all cases as the check wether the thing shall be reported or not is done in TPS_Logger.isLogging.

By asking whether the according write to log is wished before, we speed up TAPAS by about 50 %. Really.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants