fix: Clean up config migration logging

This commit is contained in:
Ben Woo 2023-03-24 14:16:03 +08:00
parent 433160f187
commit 136bd3cbe2
No known key found for this signature in database
GPG Key ID: FB2A3645536E12C8
2 changed files with 2 additions and 4 deletions

View File

@ -23,9 +23,8 @@ public class ConfigMigrator {
public void migrate(MVSettings settings) {
double versionNumber = settings.get(versionNode);
for (VersionMigrator versionMigrator : versionMigrators) {
Logging.info("Checking if config needs to be migrated from version " + versionNumber + " to " + versionMigrator.getVersion());
if (versionNumber < versionMigrator.getVersion()) {
Logging.info("Migrating config from version " + versionNumber + " to " + versionMigrator.getVersion());
Logging.config("Migrating config from version %s to %s...", versionNumber, versionMigrator.getVersion());
versionMigrator.migrate(settings);
}
}

View File

@ -20,12 +20,11 @@ public class MoveMigratorAction implements MigratorAction {
@Override
public void migrate(MVSettings settings) {
Logging.info(String.valueOf(settings.getConfig().get(fromPath)));
Optional.ofNullable(settings.getConfig().get(fromPath))
.ifPresent(value -> {
Logging.info("Moving " + fromPath + " to " + toPath);
settings.getConfig().set(toPath, value);
settings.getConfig().set(fromPath, null);
Logging.config("Moved path %s to %s", fromPath, toPath);
});
}
}