DLR-VF / TAPAS

MIT License
19 stars 9 forks source link

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

Open schakalakka opened 1 year ago

schakalakka commented 1 year ago

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?

dkrajzew commented 1 year ago

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.