modify logger calls for computable messages via closures

This commit is contained in:
Jonathan Shook
2022-12-21 19:37:36 -06:00
parent a06cf565ee
commit 6731937c96
114 changed files with 317 additions and 313 deletions

View File

@@ -89,7 +89,7 @@ public class S3Uploader implements ScenarioMetadataAware {
combined
)
.orElseThrow();
logger.debug("S3 composite URL is '" + url + "'");
logger.debug(() -> "S3 composite URL is '" + url + "'");
S3UrlFields fields = S3UrlFields.fromURLString(url);
S3ClientCache s3ClientCache = new S3ClientCache();

View File

@@ -37,7 +37,7 @@ public class ScriptingMetrics {
public ScriptingGauge newGauge(String name, double initialValue) {
ScriptingGauge scriptingGauge = new ScriptingGauge(name, initialValue);
ActivityMetrics.gauge(scriptContext,name, scriptingGauge);
logger.info("registered scripting gauge:" + name);
logger.info(() -> "registered scripting gauge:" + name);
return scriptingGauge;
}

View File

@@ -42,7 +42,7 @@ public class ShutdownHookPlugin {
Thread runnable = new ShutdownRunnableFunction(logger, name, (Function<?,?>)f);
runnable.setName(shutdownName);
Runtime.getRuntime().addShutdownHook(runnable);
logger.info("Registered shutdown hook to run under name '" + shutdownName + "'");
logger.info(() -> "Registered shutdown hook to run under name '" + shutdownName + "'");
}
}

View File

@@ -34,13 +34,13 @@ public class ShutdownRunnableFunction extends Thread {
@Override
public void run() {
logger.info("Running shutdown hook '" + name + "'...");
logger.info(() -> "Running shutdown hook '" + name + "'...");
try {
Object result = function.apply(new Object[0]);
if (result instanceof CharSequence) {
logger.info("shutdown hook returned output:\n" + result);
logger.info(() -> "shutdown hook returned output:\n" + result);
}
logger.info("Completed shutdown hook '" + name + "'...");
logger.info(() -> "Completed shutdown hook '" + name + "'...");
} catch (Exception e) {
throw new RuntimeException(e);
}

View File

@@ -84,8 +84,8 @@ public class TestOptimoExperiments {
);
PointValuePair result = mo.optimize(od.toArray(new OptimizationData[0]));
logger.debug(
"point:" + Arrays.toString(result.getPoint()) +
logger.debug(() ->
"point:" + Arrays.toString(result.getPoint()) +
" value=" + m.value(result.getPoint())
);