[MINOR] - Add plugin version summary (#6221)

* Add plugin version to summary on startup

Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>

* Remove test code

Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>

---------

Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
pull/6226/head
Gabriel-Trintinalia 12 months ago committed by GitHub
parent 3ec078ae7c
commit bbb6c83eaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      besu/src/main/java/org/hyperledger/besu/services/BesuPluginContextImpl.java

@ -124,8 +124,9 @@ public class BesuPluginContextImpl implements BesuContext, PluginVersionsProvide
try {
plugin.register(this);
LOG.info("Registered plugin of type {}.", plugin.getClass().getName());
lines.add(String.format(plugin.getClass().getSimpleName()));
addPluginVersion(plugin);
String pluginVersion = getPluginVersion(plugin);
pluginVersions.add(pluginVersion);
lines.add(String.format("%s (%s)", plugin.getClass().getSimpleName(), pluginVersion));
} catch (final Exception e) {
LOG.error(
"Error registering plugin of type "
@ -156,7 +157,7 @@ public class BesuPluginContextImpl implements BesuContext, PluginVersionsProvide
return lines;
}
private void addPluginVersion(final BesuPlugin plugin) {
private String getPluginVersion(final BesuPlugin plugin) {
final Package pluginPackage = plugin.getClass().getPackage();
final String implTitle =
Optional.ofNullable(pluginPackage.getImplementationTitle())
@ -166,8 +167,7 @@ public class BesuPluginContextImpl implements BesuContext, PluginVersionsProvide
Optional.ofNullable(pluginPackage.getImplementationVersion())
.filter(Predicate.not(String::isBlank))
.orElse("<Unknown Version>");
final String pluginVersion = implTitle + "/v" + implVersion;
pluginVersions.add(pluginVersion);
return implTitle + "/v" + implVersion;
}
/** Before external services. */

Loading…
Cancel
Save