Refactor TestcontainersCassandraConfiguration class and add option to log to System.out.

This commit is contained in:
John Blum
2023-05-12 14:54:08 -07:00
parent 68b8b882b7
commit ffc35f3713

View File

@@ -92,15 +92,23 @@ public class TestcontainersCassandraConfiguration extends TestCassandraConfigura
Logger logger = getLogger();
if (logger.isInfoEnabled()) {
logger.info(message, arguments);
logger.info(String.format(message, arguments), arguments);
}
}
protected void logToSystemOut(String message, Object... arguments) {
System.out.printf("%s%n", arguments);
System.out.flush();
}
private @NonNull GenericContainer<?> logContainerConfiguration(@NonNull GenericContainer<?> cassandraContainer) {
logInfo("Cassandra Testcontainer Environment Configuration:");
cassandraContainer.getEnvMap().forEach((key, value) -> logInfo("{} = [{}]", key, value));
cassandraContainer.getEnvMap().forEach((key, value) -> {
logInfo("{} = [{}]", key, value);
logToSystemOut("%s = %s", key, value);
});
return cassandraContainer;
}